INSERT INTO employees VALUES (2,'John','Roberts','45 There St , Townville','Telephonist');
INSERT INTO employees VALUES (3,'Brad','Johnson','1/34 Nowhere Blvd, Snowston','Doorman');
请确保每一个INSERT语句都是另起一行的
<html>
<body>
<?php
$db = mysql_connect("localhost", "root","password");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>n", mysql_result($result,0,"last"));
printf("Address: %s<br>n", mysql_result($result,0,"address"));
printf("Position: %s<br>n", mysql_result($result,0,"position"));
?>
</body>
</html>
最后,mysql_result()函数显示SQL查询命令所得到的各个字段的值。利用变量$result,我们就可以找到第一条记录,记录号是0,并将其中各字段的值显示出来。