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. 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. 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"; 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); ?> 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
Archived
This topic is now archived and is closed to further replies.