arvin Posted July 24, 2009 Share Posted July 24, 2009 Hello, I woyuld like to replace QUERY 1 with Query 2 and would like to include WHERE UPDATED BETWEEN '".$mind[2]."-".$mind[0]."-".$mind[1]." 00:00:00' AND '".$maxd[2]."-".$maxd[0]."-".$maxd[1]." 23:59:59'; "); in QUERY 2 but I having some difficulties. One of the questions that comes to mind is why are the syntax's different in both queries? I new to php and have a hard time understanding the syntax's ...... Here is my current query that works QUERY 1 $result = mysql_query("SELECT tickets.UPDATED, tickets.ID , tickets.GRP , tickets.C29 , tickets.OPER , departments.DEPARTMENT FROM tickets INNER JOIN departments ON tickets.GRP = departments.GRP WHERE UPDATED BETWEEN '".$mind[2]."-".$mind[0]."-".$mind[1]." 00:00:00' AND '".$maxd[2]."-".$maxd[0]."-".$maxd[1]." 23:59:59'; "); Here is the phpMyAdmin generated php code QUERY 2 $sql = 'SELECT messages.DATE, tickets.ID, departments.DEPARTMENT, tickets.C29, messages.AUTHOR' . ' FROM departments RIGHT JOIN (messages INNER JOIN tickets ON messages.TID = tickets.ID) ON departments.GRP = tickets.GRP' . ' WHERE (((tickets.C29) Not In ("CABS","Billing Inquiries","Phone Inquiries","Monthly Billing","Meeting","PP&R","Data","NCAMS","Alarms","Bus Resale","Broadcast","PIC","CPR","Trouble Shooter","Vendor PRI","Wholesale","Trainer","Trainee","Directory")) AND ((messages.AUTHOR) In (\'Annette\',\'Barb\',\'Belinda\',\'Bernadine\',\'Carole\',\'Debbie\',\'Dolly\',\'Donna\',\'Etta\',\'Jackie\',\'Kelly\',\'Lea\',\'Terry\',\'Vickie\',\'Jody\')))'; any help is appreciated Thank you in advance Link to comment https://forums.phpfreaks.com/topic/167315-trying-to-run-a-mysql-query-from-php-script/ Share on other sites More sharing options...
fenway Posted August 3, 2009 Share Posted August 3, 2009 I'm not sure I follow... did you try adding the where clause directly? Link to comment https://forums.phpfreaks.com/topic/167315-trying-to-run-a-mysql-query-from-php-script/#findComment-889919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.