首页 > 数据库技术 > 详细

PHP数据库的操作

时间:2015-04-28 18:54:40      阅读:248      评论:0      收藏:0      [点我收藏+]

<?php

$conn=mysql_connect("localhost","root","");

$result2=mysql_db_query("hello_world", "insert into hello_table values (‘add‘,8)",$conn);

$result=mysql_db_query("hello_world", "select * from hello_table",$conn);

$sss=mysql_fetch_object($result);

echo "+++++++++".$sss->age;//get the first value

$row=mysql_fetch_row($result);

for($i=0;$i<mysql_num_fields($result);$i++){

echo mysql_field_name($result, $i)." ";

}

echo "<br>";

mysql_data_seek($result, 0);

while($row=mysql_fetch_row($result)){

for($i=0;$i<mysql_num_fields($result);$i++){

echo $row[$i]." ";

}

echo "<br>";

}

mysql_free_result($result);

mysql_close($conn);

 

?>

PHP数据库的操作

原文:http://5618698.blog.51cto.com/5608698/1639729

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!