⑴ PHP怎么读取MYSQL中指定行的数据
/* 连接数据库 */
mysql_connect("localhost", "root", "123456");
mysql_select_db("name123");
/* 查找test1表中ID为1的那行所有的数据 */
$sql = "SELECT * FROM test1 WHERE `ID`='1'";
/* 执行查找 */
$result = mysql_query($sql);
/* 判断查找,如果找到的内数据数>0(也就是存在) */
if (mysql_num_rows($result) > 0){
/* 把ID=1的那行中的view字段的容数据赋值给$view */
$view = mysql_result($result, 0, view);
}
echo $view;