Home >Backend Development >PHP Tutorial >PHP MySQL Where clause learning

PHP MySQL Where clause learning

WBOY
WBOYOriginal
2016-07-25 08:55:031064browse
  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



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