在MySQL打印数据*被正式贬值,你应该使用库MySQLi *或准备语句
//$Conn = new mysqli(host, username, pass, db);
$sqlquery = "SELECT subject FROM book WHERE useid = $userid";
//Execute the query reurns data into a $result
$result = $Conn->query($sqlquery);
//results into a associative array
$resultArray = $result->fetch_all(MYSQLI_ASSOC);
print_r($resultArray);
OR PDOStatement::fetchAll
<?php
$sth = $dbh->prepare("your query");
$sth->execute();
/* Fetch all of the remaining rows in the result set */
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll();
print_r($result);
?>
啊,我明白了。多谢兄弟。 –