首頁 >後端開發 >php教程 >PHP MySQL Where子句學習

PHP MySQL Where子句學習

WBOY
WBOY原創
2016-07-25 08:55:031030瀏覽
  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