使用 php 插入记录并访问数据库 - 获取“odbc_exec() 的参数计数错误” 一切正常,但我无法将其插入数据库。
$R1=rand(1,20);
$db=odbc_connect('Eightball','','');
 $sql  = "SELECT * FROM theAnswers";
 $sql .= " WHERE id = " . $R1;
 $rs=odbc_exec($db,$sql);
while (odbc_fetch_row($rs))
{       
 $FinalAnswer=odbc_result($rs,"Answer");
 $newdate = date('M j, Y');
 $newQuestion = $_POST["Question"];
 if(isset($_SERVER['HTTP_REFERER'])) {
 $Thereferrer=$_SERVER['HTTP_REFERER'];
 }
$theIPAddress=$_SERVER['REMOTE_ADDR'];
 echo $theIPAddress;
 echo $Thereferrer;
 echo $newQuestion;
 echo $FinalAnswer;
 echo $newdate;
}
$sql = "INSERT INTO theQuestions (ipaddress, referrer, Question, Answer, theDate)     VALUES ('$theIPAddress', '$Thereferrer', '$newQuestion', '$FinalAnswer', newdate)";
$rs=odbc_exec($db,$sql);
$result = odbc_exec($sql);
if (!$result) {exit('Execution failed!');} 
    