首页  >  文章  >  后端开发  >  PHP MySQL Where子句学习

PHP MySQL Where子句学习

WBOY
WBOY原创
2016-07-25 08:55:031010浏览
  1. $con = mysql_connect("localhost","peter","abc123");

  2. if (!$con)
  3. {
  4. die('Could not connect: ' . mysql_error());
  5. }
  6. mysql_select_db("my_db", $con);

  7. $result = mysql_query("SELECT * FROM Persons

  8. WHERE FirstName='Peter'");
  9. while($row = mysql_fetch_array($result))

  10. {
  11. echo $row['FirstName'] . " " . $row['LastName'];
  12. echo "
    ";
  13. }
  14. ?>

复制代码

输出: Peter Griffin



声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn