小弟写了段代码,错误不断啊,一会是
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\search\function.php on line 9
一会又是什么什么near 'information' where news like '&search%'"有问题
到底怎样才能成功查找呢?
---------------------------------------------------------------------
<?php
  mysql_connect("localhost","root","");
  mysql_select_db("search") or die(mysql_error());
  
  $search = mysql_real_escape_string(addslashes($_POST['search']));
  
  $result = mysql_query("select news from 'information' where news like '&search%'");  while($row = mysql_fetch_assoc($result)){
     echo "<div id='link'>".$row['news']."</div>";
  }
?>
------------------------------------------------------------------
小弟在此先谢过各位大侠了

解决方案 »

  1.   

    多看php手册和mysql手册,这些都是很基础的东西Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\search\function.php on line 9说明你的的参数有问题,具体看看手册上的例子一会又是什么什么near 'information' where news like '&search%'"有问题这算mysql的问题,去看看mysql具体的sql语句的相关介绍最起码要对mysql和php都要有了解才去写代码吧,否则你的问题还会遇到更多