<?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);
?>
时间: 2024-11-10 07:47:21