3 Queries at once...HOW TO DO THIS????
Posted 06 September 2006 - 06:48 AM
At any rate... how can these three be combined to one varible that I can run in a while loop to display products on my page...I also only need one entry per item (shirt_id)...in case numerous fields match the search string...
mysql_query("SELECT * FROM shirtcolors
LEFT JOIN colors ON shirtcolors.color_id = colors.color_id
LEFT JOIN shirts ON shirtcolors.shirt_id = shirts.shirt_id
WHERE color = '$colorsearch' ORDER BY shirts.$field $direction") or die(mysql_error());
mysql_query("SELECT * FROM shirtkeywords
LEFT JOIN keywords ON shirtkeywords.keyword_id = keywords.keyword_id
LEFT JOIN shirts ON shirtkeywords.shirt_id = shirts.shirt_id
WHERE keyword = '$keywordsearch' ORDER BY $field $direction") or die(mysql_error());
mysql_query("SELECT * FROM shirts WHERE notes like'%$search%' OR name like'%$search%'") or die(mysql_error());
Posted 06 September 2006 - 05:48 PM
Each array is basically a set, so we take the UNION of any two minus their INTERSECTION.
$Result = array_merge( $arr1, array_diff($arr2, $arr1) );
$Result = array_merge( $Result, array_diff($arr3, $Result) );
Perhaps there is a better way, but that should do the trick.
Posted 06 September 2006 - 05:51 PM
mysql_query("query 1; query2; query 3;");
If you don't understand what I mean, then I mean that you just have to seperate the queries with semi-colons ( ; ).
Posted 06 September 2006 - 06:21 PM
Posted 06 September 2006 - 06:44 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users