Home  >  Article  >  Backend Development  >  #生手来袭# 关于mysql_query()函数

#生手来袭# 关于mysql_query()函数

WBOY
WBOYOriginal
2016-06-13 13:18:39883browse

#新手来袭# 关于mysql_query()函数
$con=mysql_connect('localhost','root','root','findbottle')
  or die('Error connecting to MySQL server');


  $sql="SELECT * FROM find";

  $result=mysql_query($sql,$con)
  or die('Error query database');

  mysql_close($con);

求解为什么这段函数老是提示出错???

提示问题出在mysql_query()那里,求大神指教,sql语句没有错...

------解决方案--------------------
mysql_select_db('库名',$con); //少了这句

$result=mysql_query($sql,$con) or die(mysql_error()); //看还报错吗

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn