没有直接返回数据集的
可以将返回结果fetch后,放到array里面,然后这个array就相当于一个ResultSet
$result = mysql_query($sql,$conn) or die("executeSql Error!");
$records = "";
while($record = mysql_fetch_array($result))
$records[] = $record;
mysql_free_result($result);
print_r($records);
可以将返回结果fetch后,放到array里面,然后这个array就相当于一个ResultSet
$result = mysql_query($sql,$conn) or die("executeSql Error!");
$records = "";
while($record = mysql_fetch_array($result))
$records[] = $record;
mysql_free_result($result);
print_r($records);
能帮我修改一下代码吗?
为了显示多行数据.<meta charset="utf8"/>
<?
//连接
$link = mysql_connect("localhost","root","123456");
//选择数据库
mysql_select_db("dbphp");
//sql语句
$result =mysql_query("select * from user",$link);
//以HTML的方式返回解析的数据
echo "<table border=1>\n";
echo "<tr>\n";
//显示表头
while ($field = mysql_fetch_field($result)){
echo "<td>".$field->name."</td>\n";
}
echo "</tr>\n";
//显示表身
while ($row = mysql_fetch_array($result)){
echo "<tr>\n";
for($si=0;$i<count($row);$i++){
echo "<td>".$row[$i]."</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
//释放result
mysql_free_result($result);
//关闭连接
mysql_close($link);?>