forumnz Posted December 29, 2007 Share Posted December 29, 2007 What could be causing this? include('dbcon.php'); $sql = "SELECT buzzname FROM cmads WHERE buzzname LIKE '%" . $_POST['search'] . "%' OR WHERE keywords LIKE '%" . $_POST['search'] . "%' LIMIT 12"; $rs = mysql_query($sql); ?> <ul> <? while($data = mysql_fetch_assoc($rs)) { ?> <li><? echo stripslashes($data['buzzname']);?></li> <? } ?> </ul> Thank you, Sam. Quote Link to comment https://forums.phpfreaks.com/topic/83617-mysql_fetch_assoc-supplied-arg-error/ Share on other sites More sharing options...
revraz Posted December 29, 2007 Share Posted December 29, 2007 Change $rs = mysql_query($sql); to $rs = mysql_query($sql) or die ("Error in query: $sql. " . mysql_error()); Then you'll see what error you have in your $sql statement. Quote Link to comment https://forums.phpfreaks.com/topic/83617-mysql_fetch_assoc-supplied-arg-error/#findComment-425393 Share on other sites More sharing options...
revraz Posted December 29, 2007 Share Posted December 29, 2007 Looks like one too many WHEREs to me WHERE buzzname LIKE '%" . $_POST['search'] . "%' OR keywords LIKE '%" . $_POST['search'] . "%' LIMIT 12"; Quote Link to comment https://forums.phpfreaks.com/topic/83617-mysql_fetch_assoc-supplied-arg-error/#findComment-425398 Share on other sites More sharing options...
redarrow Posted December 29, 2007 Share Posted December 29, 2007 try this........ (| Bitwise OR added) <?php $sql = "SELECT buzzname FROM cmads WHERE buzzname LIKE '%" . $_POST['search'] . "%' | keywords LIKE '%" . $_POST['search'] . "%' LIMIT 12"; $rs = mysql_query($sql); ?> Quote Link to comment https://forums.phpfreaks.com/topic/83617-mysql_fetch_assoc-supplied-arg-error/#findComment-425407 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.