连接mysql(mysql_connect())
选择你创建的数据库(mysql_select_db())
sql语句的执行(mysql_query())
显示取出来的数据(mysql_fetch_array())
关闭连接(mysql_close())
<?php
$conn=mysql_connect('localhost','root','');
if($conn){
print_r("ok");
}
else{
print_r("error");
}
mysql_select_db('node',$conn);
$sql="select * from nd_wp";
$result=mysql_query($sql);
var_dump($result);
while($row = mysql_fetch_array($result))
{
echo $row['name'];
}
mysql_close($conn);
?>