Query failed:SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROMmembersORDER BY username LIMIT 0,5' at line 1
找来找去都没发现错
FROMmembersORDER 这里没发现吗
把sql贴出来吧。
... FROM members ORDER BY username LIMIT 0,5
10184cd0914e284eedc6fb049b7bfce1
c1a436a314ed609750bd7c7d319db4daDisplaying membersa1fd223bed23810d743f9265c268becc-1ea31660091e313bf235a88eb352757eof3dd96aed9e16a9f08a47dbef3eca65662e9b454fa8428549ca2e64dfac4625cd
38f0094f1b21635b0d98abf7ba03a026
a34de1251f0d9fe1e645927f19a896e8
b4d429308760b6c2d20d6300079ed38effcad3b62db8f0457ce08598e8e36516690a4fe8b746a682971d5c9a9b36ad08b517c7019a86fd2c96d2a5cf3002de78Username b4ad7b9765548ffb5373798880422b595db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
b4d429308760b6c2d20d6300079ed38e0017af9af110f3fb2febc7091be49f4ec66c32ec06b534c2b6b030f0bb7a1bc3b517c7019a86fd2c96d2a5cf3002de78First name 3e5ebe9f9193d9ab93a432351b5257e55db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
b4d429308760b6c2d20d6300079ed38e6e18c742f5cbb3afbfc108cf427f569f670950368fdee066bf4f5c95e2cc5e6eb517c7019a86fd2c96d2a5cf3002de78Last name 9acbc2d1c8276c94422e6650315379bc5db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
fd273fcf5bcad3dfdad3c41bd81ad3e5
b6da750fafac4605e21aee06f9765a61
6c4773cdd4202b0964a4659bf326e20a>
b6c5a531a458a2e790c1fd6421739d1c5c799edab2f8e7aff2df9447c86e18cbgetValueEncoded("id")?>">
e339afdf106b844c7a3a5ccc72b40a07getValueEncoded("username")?>5db79b134e9f6b82c0b36e0489ee08edb90dd5946f0946207856a8a37f441edf
b6c5a531a458a2e790c1fd6421739d1ce339afdf106b844c7a3a5ccc72b40a07getValueEncoded("firstname")?>b90dd5946f0946207856a8a37f441edf
b6c5a531a458a2e790c1fd6421739d1ce339afdf106b844c7a3a5ccc72b40a07getValueEncoded("lastname")?>b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a0dc5e8a55506057f6c76c056ce63ff1
f16b1740fad44fb09bfe928bcc527e08
eeaf339f85e911f4ea222747c6de7a1b
7d1d7ee7328ea4ad3c5f9c97b6e51bc30){?>
4cd4a4404233c8aec892045bb59be158&
order=f268b0b664056b4b74ae362cd2e2efd5">Previous page5db79b134e9f6b82c0b36e0489ee08edb517c7019a86fd2c96d2a5cf3002de78
1e91de43b5f93da7262fa0bb91a4a3df
e942f30b47aaf7b1b8e7ab864f7446a8&order=f268b0b664056b4b74ae362cd2e2efd5">Next page5db79b134e9f6b82c0b36e0489ee08ed
b517c7019a86fd2c96d2a5cf3002de78
16b28748ea4df4d9c2150843fecfba68
8c2a2ba179685e475a3fce783dd9698f
FROMmembersORDER 这里没发现吗
等级:Blank
#4 得分:0 回复于: 2013-11-15 15:40:40
10184cd0914e284eedc6fb049b7bfce1
c1a436a314ed609750bd7c7d319db4daDisplaying membersa1fd223bed23810d743f9265c268becc-1ea31660091e313bf235a88eb352757eof3dd96aed9e16a9f08a47dbef3eca65662e9b454fa8428549ca2e64dfac4625cd
38f0094f1b21635b0d98abf7ba03a026
a34de1251f0d9fe1e645927f19a896e8
b4d429308760b6c2d20d6300079ed38effcad3b62db8f0457ce08598e8e36516690a4fe8b746a682971d5c9a9b36ad08b517c7019a86fd2c96d2a5cf3002de78Username b4ad7b9765548ffb5373798880422b595db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
b4d429308760b6c2d20d6300079ed38e0017af9af110f3fb2febc7091be49f4ec66c32ec06b534c2b6b030f0bb7a1bc3b517c7019a86fd2c96d2a5cf3002de78First name 3e5ebe9f9193d9ab93a432351b5257e55db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
b4d429308760b6c2d20d6300079ed38e6e18c742f5cbb3afbfc108cf427f569f670950368fdee066bf4f5c95e2cc5e6eb517c7019a86fd2c96d2a5cf3002de78Last name 9acbc2d1c8276c94422e6650315379bc5db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
fd273fcf5bcad3dfdad3c41bd81ad3e5
b6da750fafac4605e21aee06f9765a61
6c4773cdd4202b0964a4659bf326e20a>
b6c5a531a458a2e790c1fd6421739d1c5c799edab2f8e7aff2df9447c86e18cbgetValueEncoded("id")?>">
e339afdf106b844c7a3a5ccc72b40a07getValueEncoded("username")?>5db79b134e9f6b82c0b36e0489ee08edb90dd5946f0946207856a8a37f441edf
b6c5a531a458a2e790c1fd6421739d1ce339afdf106b844c7a3a5ccc72b40a07getValueEncoded("firstname")?>b90dd5946f0946207856a8a37f441edf
b6c5a531a458a2e790c1fd6421739d1ce339afdf106b844c7a3a5ccc72b40a07getValueEncoded("lastname")?>b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a0dc5e8a55506057f6c76c056ce63ff1
f16b1740fad44fb09bfe928bcc527e08
eeaf339f85e911f4ea222747c6de7a1b
7d1d7ee7328ea4ad3c5f9c97b6e51bc30){?>
4cd4a4404233c8aec892045bb59be158&
order=f268b0b664056b4b74ae362cd2e2efd5">Previous page5db79b134e9f6b82c0b36e0489ee08edb517c7019a86fd2c96d2a5cf3002de78
1e91de43b5f93da7262fa0bb91a4a3df
e942f30b47aaf7b1b8e7ab864f7446a8&order=f268b0b664056b4b74ae362cd2e2efd5">Next page5db79b134e9f6b82c0b36e0489ee08ed
b517c7019a86fd2c96d2a5cf3002de78
16b28748ea4df4d9c2150843fecfba68
8c2a2ba179685e475a3fce783dd9698f
... FROM members ORDER BY username LIMIT 0,5
等级:Blank
#4 得分:0 回复于: 2013-11-15 15:40:40
10184cd0914e284eedc6fb049b7bfce1
c1a436a314ed609750bd7c7d319db4daDisplaying membersa1fd223bed23810d743f9265c268becc-1ea31660091e313bf235a88eb352757eof3dd96aed9e16a9f08a47dbef3eca65662e9b454fa8428549ca2e64dfac4625cd
38f0094f1b21635b0d98abf7ba03a026
a34de1251f0d9fe1e645927f19a896e8
b4d429308760b6c2d20d6300079ed38effcad3b62db8f0457ce08598e8e36516690a4fe8b746a682971d5c9a9b36ad08b517c7019a86fd2c96d2a5cf3002de78Username b4ad7b9765548ffb5373798880422b595db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
b4d429308760b6c2d20d6300079ed38e0017af9af110f3fb2febc7091be49f4ec66c32ec06b534c2b6b030f0bb7a1bc3b517c7019a86fd2c96d2a5cf3002de78First name 3e5ebe9f9193d9ab93a432351b5257e55db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
b4d429308760b6c2d20d6300079ed38e6e18c742f5cbb3afbfc108cf427f569f670950368fdee066bf4f5c95e2cc5e6eb517c7019a86fd2c96d2a5cf3002de78Last name 9acbc2d1c8276c94422e6650315379bc5db79b134e9f6b82c0b36e0489ee08edbe87d491f710a70a3787e6e56494aad501c3ce868d2b3d9bce8da5c1b7e41e5b
fd273fcf5bcad3dfdad3c41bd81ad3e5
b6da750fafac4605e21aee06f9765a61
6c4773cdd4202b0964a4659bf326e20a>
b6c5a531a458a2e790c1fd6421739d1c5c799edab2f8e7aff2df9447c86e18cbgetValueEncoded("id")?>">
e339afdf106b844c7a3a5ccc72b40a07getValueEncoded("username")?>5db79b134e9f6b82c0b36e0489ee08edb90dd5946f0946207856a8a37f441edf
b6c5a531a458a2e790c1fd6421739d1ce339afdf106b844c7a3a5ccc72b40a07getValueEncoded("firstname")?>b90dd5946f0946207856a8a37f441edf
b6c5a531a458a2e790c1fd6421739d1ce339afdf106b844c7a3a5ccc72b40a07getValueEncoded("lastname")?>b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a0dc5e8a55506057f6c76c056ce63ff1
f16b1740fad44fb09bfe928bcc527e08
eeaf339f85e911f4ea222747c6de7a1b
7d1d7ee7328ea4ad3c5f9c97b6e51bc30){?>
4cd4a4404233c8aec892045bb59be158&
order=f268b0b664056b4b74ae362cd2e2efd5">Previous page5db79b134e9f6b82c0b36e0489ee08edb517c7019a86fd2c96d2a5cf3002de78
1e91de43b5f93da7262fa0bb91a4a3df
e942f30b47aaf7b1b8e7ab864f7446a8&order=f268b0b664056b4b74ae362cd2e2efd5">Next page5db79b134e9f6b82c0b36e0489ee08ed
b517c7019a86fd2c96d2a5cf3002de78
16b28748ea4df4d9c2150843fecfba68
a5a329ea8b4b7d0173a849a0a1759d40
getMembers 関数の記述方法によって異なります。 ... ;
getMembers 関数の記述方法によって異なります。
2d7a884bd2c5e9c6bbf32eecb5b0c2e8"",
"username"=>"",
"パスワード"=>""、
"名"=>""、
"姓"=>""、
"参加日"=>""、
"性別"=>""、
" favouriteGenre"=>"",
"emailAddress"=>"",
"otherInterests"=>""
);
private $_genres = array(
"crime"=>"犯罪",
"ホラー"=>"ホラー"、
"スリラー"=>"スリラー"、
"ロマンス"=>"ロマンス"、
"sciFi"=>"サイエンスフィクション"、
"アドベンチャー"=> ;"アドベンチャー",
"nonFiction"=>"ノンフィクション"
);
public static function getMembers($startRow,$numRows,$order){
$conn =parent::connect(); = "SELECT SQL_CALC_FOUND_ROWS * FROM".TBL_MEMBERS."ORDER BY $order LIMIT :startRow,:numRows";
try{
$st = $conn->prepare($sql);
$st->bindValue( ":startRow",$startRow,PDO::PARAM_INT);
$st->bindValue(":numRows",$numRows,PDO::PARAM_INT);
$st->execute(); array();
foreach($st->fetchAll() as $row){
$members[] = 新しいメンバー($row) }
$st = $conn->query("SELECT found_rows( ) AS totalRows");
$row = $st->fetch();
parent::disconnect($conn);
return array($members,$row["totalRows"]);
}catch(PDOException) $e){
parent::disconnect($conn);
die("Query failed:".$e->getMessage());
}
}
public static function getMember($id){
$ conn =parent::connect();
$sql = "SELECT * FROM". WHERE id = :id";
$st = $conn->prepare($sql); ->bindValue(":id",$id,PDO::PARAM_INT);
$st->execute();
$row = $st->fetch(); );
if($row) return new Member($row);
}catch(PDOException $e){
parent::disconnect($conn);
die("クエリが失敗しました:".$e->getMessage ());
}
}
public function getGenderString(){
return($this->data["gender"]=="f")?"女性":"男性"; getFavoriteGenreString(){
return ($this->_genres[$this->data["favoriteGenre"]]);
}
}
?>
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM ".TBL_MEMBERS." ORDER BY $order LIMIT :startRow,:numRows"; //复制这句试试
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM ".TBL_MEMBERS." ORDER BY $order LIMIT :startRow,:numRows"; //复制这句试试
from の前後にスペースが追加されています
from の前後にスペースが追加されています
これは何が間違っていますか? なぜこのように変更されたのですか?
基本的な SQL 構文、クラスメート、本を読む時間です。