一切都运转良好,然后我不断得到999作为最后一个值。我假设它看到9大于1000中的1。我可能错了。但是它不会返回超过1000的任何内容。代码发布在下面。任何帮助都会很棒。
$db = new PDO('mysql:host='. $host .';dbname='.$db_name, $db_username, $db_password);
$statement = $db->prepare("select * from users where user_name = :user_name");
$statement->execute(array(':user_name' => $user)); //change send to variable
$row = $statement->fetch();
///////////////////////////////////////////////////////////////////////////////////////////////////////////
$db2 = new PDO('mysql:host='. $host .';dbname='.$db_name_uroll, $db_username, $db_password);
//Remove $db2 prepare
$statement2 = "select * from `{$user}` ORDER BY bet_id DESC LIMIT 23";
$bid = array();
if ($stmt = $db2->query($statement2)) //PDO::query() returns a PDOStatement on success or false on failure.
{
//If we got a PDOStatement as a return value from PDO::Query() !!!ECHO WHILE FETCHING!!!
while($row2 = $stmt->fetch(PDO::FETCH_ASSOC)) //This loop will keep going for as many rows as the PDOStatement returns.
{
$bid[] = $row2['bet_id'] ;
}
}
答案 0 :(得分:-1)
SELECT column_name,column_name
FROM table_name
ORDER BY column_name,column_name ASC|DESC;