mysql_connect('localhost','root','pass');//连接数据库
mysql_select_db('test');//选择一个数据库
mysql_query();//执行sql语句
mysql_fetch_array()//函数将结果集以数组的形势返回,用于while 遍历数组
连接数据库的sql查询
mysql_connect('localhost','root','pass');
mysql_set_charset('utf8');
mysql_select_db('test');
$result=mysql_query("select * from table order by time desc limit 0,10");
while($rows=mysql_fetch_array($result)){
echo $rows['name'];
echo $rows['pass'];
echo $rows['time'];
}
如何执行添加
mysql_connect('locahost','root','pass');
mysql_select_db('test');
mysql_query(insert into table(name,pass,time)values("张三","1234","date"))
阅读(147) | 评论(0) | 转发(0) |