$dbh = @mysql_connect("localhost:3306","root","9999");
/* Define the variable dbh, the mysql_connect() function means to connect to the mysql database, "@" It means to block error */
if(!$dbh){die("error");}
/* The die() function means to send the string in brackets to the browser and interrupt PHP Script. The parameters in brackets are the string to be sent. */
@mysql_select_db("ok", $dbh);
/* Select a database in the mysql server. The database name selected here is ok */
$q = "SELECT * FROM abc" ;
/* Define variable q, "SELECT * FROM abc" is a SQL statement, which means reading the data in table abc */
?>
$rs = mysql_query($q, $dbh);
/* Define the variable rs, the function mysql_query() means: send the query string for MySQL to do related processing or execution. Since PHP is executed from right to left, so, The value of rs is the value returned by the server after running the mysql_query() function */
if(!$rs){die("Valid result!");}
echo "
ID | Name |
$row[1] |