Jump to content

SchweppesAle

Members
  • Posts

    328
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

SchweppesAle's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Something like this? if(isset($_REQUEST['task'])) { case 'email_recipients': $result = email_recipients($_REQUEST['member_emails']); //add error checking print '<h3>Emails sent out successfully</h3>'; break; } function email_recipients($email_array) { if(is_array($email_array)) { $headers = //blah; $subject = blah; $from = blah; foreach($email_array as $recip_email) { mail($recip_email, etc); } } } print ' <form action = "" method = "post" >'; $res = mysql_query("SELECT * FROM members") or die(mysql_error()); while ($member = mysql_fetch_array($res)) { print '<input type = "checkbox" name = "member_emails[]" value = "'.$member['email'].'" /> '.$member['email'].' <br/>'; } print ' <input type = "hidden" name = "task" value = "email_recipients" /> <input type = "submit" value = "submit" /> </form>';
  2. Was just wondering why some people choose NOT to make use of static functions when initializing objects via Factory Classes/Containers. What are the benefits of initializing the Factory class when for all intensive purposes, it's only used to initialize new classes, etc? Does this have any impact on Dependency Injection? I'm assuming that it doesn't since that would defeat the purpose. --------- Also, I've noticed that there seems to be an intense stigma within the development community in regard to singletons. Are singletons necessarily a bad thing? What about database objects? One argument I've heard is that this can often impact the flexibility of your application in the event that a new instance of said class needs to be initialized(a second completely separate connection). However, I was thinking that you could simply store these objects within a static member variable in the factory class; leaving the Database Class' __construct public in the event that you need to create that second/third/fourth connection. Wouldn't this resolve the issue?
  3. Not really sure what to make of the following: function pfi_import_xml_menu(pfiImportStruct & $import_struct, SimpleXMLElement $xml_obj, $parent_artifact_id = true, $p_max = null, $disp_order = null) What does the & imply for the first argument?
  4. http://ongopongo.com/maps/google_my_maps_embedding_tool http://www.blogstorm.co.uk/geotargeting-with-php/
  5. Hey, I was just wondering if there's a way to speed up how quickly Linux opens files. I noticed that after having implemented File Caching, the data takes 1/3 times longer to retrieve after having refreshed the page(via fopen). Probably due to the file still being in memory. Are there any apache/linux settings which I can modify which will reduce this time even further. Maybe even keep the (temporary) cached files in memory? hdparm, etc.
  6. Hi, just started experimenting with file caching after reading this article: http://www.rooftopsolutions.nl/blog/107 Aside from when dealing with data which changes frequently, I was wondering if it's ever inappropriate to cache your queries. For example, I have a page with a ridiculous number of queries, some of them have a resulting set which is not nearly as large as others. Page performance increased, just not to the level I had been expecting and I wondering if having Apache read each of these files for data is in fact faster than running a number of queries with only some data being cached.
  7. Something like this? $search = $_POST['search']; if(!is_null($search)) { $replacement = '<font style="background-color: yellow;">'.$search.'</font>'; $string = str_replace($search, $replacement, $string); }
  8. Think this might have done the trick select * FROM ((SELECT events.eventid , events.date , events.name , events.venue , events.venueid , venues.zipcode FROM events INNER JOIN venues ON (events.venueid = venues.venueid) where events.child_category_id='24' and events.parent_category_id='2' and events.status='1' AND venues.zipcode IN ('07087','07086','10272','07093','07030','07047','07097','10130','07307','07096','10125','10072','10099','11249','10161') group by events.name order by date asc) union (SELECT events.eventid , events.date , events.name , events.venue , events.venueid , venues.zipcode FROM events INNER JOIN venues ON (events.venueid = venues.venueid) where events.child_category_id='24' and events.parent_category_id='2' and events.status='1' AND venues.zipcode NOT IN ('07087','07086','10272','07093','07030','07047','07097','10130','07307','07096','10125','10072','10099','11249','10161') group by events.name order by date asc)) AS Table3 w00t, executing Unions. Thanks for the advice man.
  9. alright..here's a test query which I'm trying to run through phpmyadmin. select * FROM ((SELECT events.eventid , events.date , events.name , events.venue , events.venueid , venues.zipcode FROM events INNER JOIN venues ON (events.venueid = venues.venueid) where events.child_category_id='24' and events.parent_category_id='2' and events.status='1' AND venues.zipcode IN ('07087','07086','10272','07093','07030','07047','07097','10130','07307','07096','10125','10072','10099','11249','10161') group by events.name order by date asc) union (SELECT events.eventid , events.date , events.name , events.venue , events.venueid , venues.zipcode FROM events INNER JOIN venues ON (events.venueid = venues.venueid) where events.child_category_id='24' and events.parent_category_id='2' and events.status='1' AND venues.zipcode NOT IN ('07087','07086','10272','07093','07030','07047','07097','10130','07307','07096','10125','10072','10099','11249','10161') group by events.name order by date asc) ) That returns the following: "#1248 - Every derived table must have its own alias " So I tried this: select * FROM ((SELECT events.eventid , events.date , events.name , events.venue , events.venueid , venues.zipcode FROM events INNER JOIN venues ON (events.venueid = venues.venueid) where events.child_category_id='24' and events.parent_category_id='2' and events.status='1' AND venues.zipcode IN ('07087','07086','10272','07093','07030','07047','07097','10130','07307','07096','10125','10072','10099','11249','10161') group by events.name order by date asc) AS Table1 union (SELECT events.eventid , events.date , events.name , events.venue , events.venueid , venues.zipcode FROM events INNER JOIN venues ON (events.venueid = venues.venueid) where events.child_category_id='24' and events.parent_category_id='2' and events.status='1' AND venues.zipcode NOT IN ('07087','07086','10272','07093','07030','07047','07097','10130','07307','07096','10125','10072','10099','11249','10161') group by events.name order by date asc) AS Table2) AS Table3 Which returns: "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS Table2 ) AS Table3 " Feels like I'm getting close at least
  10. ummmm...I'm really not too familiar with Unions. How would that look exactly?
  11. Yea, I mean the trick is to place all entries which match that venues.zipcodes IN() clause at the top of the resulting set without excluding all the others. Is there anyway of doing this?
  12. Hi, I have the following query which returns all events which fall within a specific list of zip codes. I'd like to know if there's a way of modifying the query so that all entries which don't meet the 'IN' clause are simply displayed after the resulting set. Basically, we're trying to prioritize local events by displaying them first without excluding the others. SELECT events.name , events.time , events.eventid , photos.thumb_file FROM events INNER JOIN performers ON (events.eventid = performers.eventid) INNER JOIN venues ON (events.venueid = venues.venueid) LEFT JOIN photos ON (performers.performerid = photos.performerid) WHERE events.child_category_id = '38' AND venues.zipcode IN ('10017','10261','10259','10174','10164','10170','10168','10087','10179','10167','10163','10166','10178','10154','10022','10158','10103','10124','10150','10173','10197','10171','10176','10165','10152','10157','10156','10043','10055','10175','10016','10020','10111','10126','10155','10104','10105','10153','10112','10151','10095','10138','10129','10010','10160','10172','10159','10018','10036','10185','10102','10149','10109','10177','10001','10108','10090','10019','10117','11120','10106','10118','10162','10122','10021','11109','10120','10060','10121','10119','10101','10107','10099','10276','11249','10123','10072','10125','10044','10113','10069','10011','10114','10003','10211','10199','10082','10133','10023','10009','10110','11222') GROUP BY performers.performer_name ORDER BY time DESC LIMIT 6
  13. I take it this isn't done very often?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.