mmcb Posted January 26, 2007 Share Posted January 26, 2007 Yep, I've got another problem for you all.I have 2 MySQL Tables (tblorder_items and tbldesigns). Both tables store a common field (DesignID). What I want to do is bring up all the records in tblorder_items where OrderID = 1 plus the fields from the tbldesigns table where the DesignID matches the DesignID in tblorder_items.This is what I've worked out so far:[code]SELECT tblorder_items. * , tbldesigns.Image1, tbldesigns.DesignName, tbldesigns.PostageFROM tblorder_items, tbldesignsWHERE tblorder_items.DesignID = tbldesigns.DesignIDORDER BY tblorder_items.DesignID[/code]At the moment it brings up all records in the tblorder_items table plus the matching details from the tbldesigns table (like it should). So to narrow the search down further and only bring up the records from the tblorder_items table where OrderID=1, do I just add in:[code] AND tblorder_items.OrderID=1[/code] into the WHERE clause?Cheers and thanks for all your help,MMCB Link to comment https://forums.phpfreaks.com/topic/35814-sql-query-problem/ Share on other sites More sharing options...
mmcb Posted January 26, 2007 Author Share Posted January 26, 2007 Ok, now I feel dumb.I've got it working the way it should be, sorry guys.I do however have another question:Is there a simple way to convert a list of records into an array?So array[0] = 1 record, but array[0][0] = field 1 in record 1, array[0][1] = field 2 in record 1, etc...Does that make sense?Cheers,MMCB Link to comment https://forums.phpfreaks.com/topic/35814-sql-query-problem/#findComment-169786 Share on other sites More sharing options...
Psycho Posted January 26, 2007 Share Posted January 26, 2007 while ($row = mysql_fetch_assoc($result)) { $arrayResult[] = $row;} Link to comment https://forums.phpfreaks.com/topic/35814-sql-query-problem/#findComment-169822 Share on other sites More sharing options...
mmcb Posted January 26, 2007 Author Share Posted January 26, 2007 That simple huh!!!Thanks for that :)MMCB Link to comment https://forums.phpfreaks.com/topic/35814-sql-query-problem/#findComment-169844 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.