|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
MySQL multiple queries
I am trying to display the search results for a complex query. I am a newbie and need some help.
Take a look at the following snippet: $query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%'". "AND $ClassifiedType=$row['Wanted']"); // while($ClassifiedType=$row["Wanted"]) { while ($row = mysql_fetch_array($query)) Everything before the AND works, but I want to show only these results when column ClassifiedType=Wanted. I tried many different notations, but to no avail. I also tried including it in the while snippet. How does one add these extra parameters? |
|
#2
|
|||
|
|||
|
RE: MySQL multiple queries
It appears that you have the AND pushed directly up against the closing ' mark of the previous where clause. try placing a space before the AND:
$query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%'". " AND $ClassifiedType=$row['Wanted']"); |
|
#3
|
|||
|
|||
|
RE: MySQL multiple queries
Thanks for the quick response. I just tried it and the script still does not work.
|
|
#4
|
|||
|
|||
|
RE: MySQL multiple queries
You should remove the $ from before the column name such as ClassifiedType..the $ sign denotes a variables in PHP....
|
|
#5
|
|||
|
|||
|
RE: MySQL multiple queries
I also added the '(single quote) around Wanted and now it works! Thanks a lot Matt!!
Here is the code snippet that you helped me fix: $query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%'". " AND ClassifiedType='Wanted'"); |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > MySQL multiple queries |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|