如题所述
$conn = mysql_connect ( "localhost" , "mysql_user" , "mysql_password" ) or
die( "Could not connect: " . mysql_error ());
mysql_select_db ( "mydb" );
$result = mysql_query ( "select * from mytable where rerid=62", $conn);
while ( $row = mysql_fetch_array ( $result , MYSQL_ASSOC )) {
var_dump($row);
}
mysql_free_result ( $result );
mysql_close($conn);
$result = mysql_query ( "select * from mytable where rerid in (".$rerid.")", $conn);
die( "Could not connect: " . mysql_error ());
mysql_select_db ( "mydb" );
$result = mysql_query ( "select * from mytable where rerid=62", $conn);
while ( $row = mysql_fetch_array ( $result , MYSQL_ASSOC )) {
var_dump($row);
}
mysql_free_result ( $result );
mysql_close($conn);
修改:
localhost:自己的数据IP地址,mysql_user:自己的用户名,mysql_password:自己的用户密码,mydb:自己的数据库,mytable:你截图的表名
追问这个不是循环输出吧!
$result = mysql_query ( "select * from mytable where rerid=62", $conn);
这个里面的62能不能换成变量 假如有十个人发的信息,我要把他们同时循环出来!
$result = mysql_query ( "select * from mytable where rerid in (".$rerid.")", $conn);
while 就是循环
温馨提示:答案为网友推荐,仅供参考
第1个回答 2015-03-11
根据唯一的查询出数据