当前位置:Gxlcms > PHP教程 > PHPMySQLWhere子句学习

PHPMySQLWhere子句学习

时间:2021-07-01 10:21:17 帮助过:19人阅读

  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

人气教程排行