次と前のボタンでレコードをナビゲートしたいのですが、次のエラーが発生します
「SQL 構文にエラーがあります。1 行目の 'ORDER BY Sr_no DESC LIMIT 1' 付近で使用する正しい構文については、MySQL サーバーのバージョンに対応するマニュアルを確認してください」
私のコードは
<?php
$id = $_GET['Sr_no'];
$id = $currentid;
$prevquery = "SELECT Sr_no, Entry_Date, Agent_Name, Process_Name, Donar_Name,Company_Name,Designation, Add1, Add2, Add3, Pincode, City, Contact_no,Mobile_no,Nearest_station,Suburbans, Pickup_time,Pickup_Date, Confirmation_Status,Last_Yr_Contribution,Pickup_Amount,Final_Donate_amt,Final_Status,DOB,Email_Id,Chq_Deposite_Date,Form_No,Cheque_Date,Cheque_No,Bank_Name,Chq_Amount,Pan_No,MICR_No,CLR_Loc,Batch_File,Donar_Code FROM leads WHERE Sr_no < $currentid ORDER BY Sr_no DESC LIMIT 1";
$prevresult = mysql_query($prevquery) or die(mysql_error());
while ($prevrow = mysql_fetch_array($prevresult)) {
$previd = $prevrow['Sr_no'];
}
$nextquery = "SELECT Sr_no, Entry_Date, Agent_Name, Process_Name, Donar_Name,Company_Name,Designation, Add1, Add2, Add3, Pincode, City, Contact_no, Mobile_no,Nearest_station,Suburbans, Pickup_time, Pickup_Date, Confirmation_Status, Last_Yr_Contribution, Pickup_Amount,Final_Donate_amt,Final_Status,DOB,Email_Id,Chq_Deposite_Date,Form_No,Cheque_Date,Cheque_No,Bank_Name,Chq_Amount,Pan_No,MICR_No,CLR_Loc,Batch_File,Donar_Code FROM leads WHERE Sr_no < $currentid ORDER BY Sr_no DESC LIMIT 1";
$nextresult = mysql_query($nextquery) or die(mysql_error());
while ($nextrow = mysql_fetch_array($nextresult)) {
$nextid = $nextrow['Sr_no'];
}
?>
<a href="edit1.php?Sr_no=<?php echo $previd; ?>">Previous</a>
<a href="edit1.php?Sr_no<?php echo $nextid; ?>">Next</a>