Jump to content

help with where clause


MDanz

Recommended Posts

this isn't working out.  I want the first part of the if statement to get both results in mysql with adult=1 and 0.  i think i did it wrong.  Whats the correct way?

 

	
  if($adulton == 1) { 
$adult="adult=1 AND adult=0";
}
else {
$adult="adult=0";
}

 

WHERE keywords LIKE '$letter%' AND Amount>=1 AND $adult 

Link to comment
https://forums.phpfreaks.com/topic/207814-help-with-where-clause/
Share on other sites

thanks but now the first parts of the where clause are being ignored.  Do i have to use brackets around $adult to make it specific.?

 

SELECT DISTINCT keywords FROM Core WHERE keywords LIKE '$letter%' AND Amount>=1 AND $adult ORDER BY keywords DESC"

 

this is getting all rows from mysql where adult='0'.. it is ignoring the keywords LIKE '$letter%' AND Amount>=1

thanks for help.  i have 1 row in mysql where adult=1. the rest are adult=0.

 

When i run the query i want to filter out the adult results.  For some reason the query isn't working.

 

when i turnoff the adult filter... it shows both adult=1 and adult=0 rows, when it should only show adult=0 rows.  It's a query problem.

 

any idea why?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.