jesushax Posted October 13, 2008 Share Posted October 13, 2008 hi below is my sql $VACSQL = mysql_query("SELECT * FROM tblVacancies WHERE Archive='0' AND CityCat LIKE '$CAT' OR ConsCat LIKE '$CAT' ORDER BY DateAdded DESC") or die(mysql_error()); what im trynig to do is get all records that have Archive 0 and either City Cat or ConsCat is like the variable $Cat at the moment if i click a CityCat link and the above sql is run on the next page it works if i click a Cons Cat Link the sql above shows all the correct ConsCat but it shows all Archive but the archive says only if 0, i dont understand why can anyone help me out? Cheers Link to comment https://forums.phpfreaks.com/topic/128204-solved-sql-statement-confused-someone-explain/ Share on other sites More sharing options...
waynew Posted October 13, 2008 Share Posted October 13, 2008 Try $VACSQL = mysql_query("SELECT * FROM tblVacancies WHERE Archive='0' AND (CityCat LIKE '$CAT' OR ConsCat LIKE '$CAT') ORDER BY DateAdded DESC") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/128204-solved-sql-statement-confused-someone-explain/#findComment-663984 Share on other sites More sharing options...
jesushax Posted October 13, 2008 Author Share Posted October 13, 2008 hey that works thanks so what do the braces do in sql? and when would i use them? Cheers Link to comment https://forums.phpfreaks.com/topic/128204-solved-sql-statement-confused-someone-explain/#findComment-663987 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.