我已经使用了教程、示例并查看了有关我的问题的许多其他问题,但我仍然无法让它工作,我对 PHP 比较陌生,对 PDO 没有任何了解。我已将我的代码更改为 mysqli 而不是 mysql,以摆脱我的大学给我的贬值代码,但在这种情况下它们的帮助不大。
如果有人能为我阐明这个问题,我将不胜感激。以下是我的代码示例:
<?php /*connect to the db */
   $link=mysqli_connect("dbhost","user","pass");
   mysqli_select_db("db",$link);
   /*checking connection*/
      if ($link->connect_errno) 
        throw new exception(sprintf("Could not connect: %s", $link->connect_error));
session_start();
        $insert_query="
        INSERT INTO testone_tbl (age,hours,flexibility,fastpaced,retailexp,
        workedus,conviction,permit,education)
        VALUES ('$age','$hours','$flexibility','$fastpaced','$retailexp','$workedus',
        '$conviction','$permit','$education'); 
        INSERT INTO testtwo_tbl 
        (contribute,insales,initiative,success,alternatives,targets,
        newthings,custfeed,incdevelop,standards,confident,stretch,
        opportunities,polite,ideas,deadline,supported,duties)
        VALUES ('$contribute','$insales','$initiative',
        '$success','$alternatives','$targets','$newthings',
        '$custfeed','$incdevelop','$standards','$confident','$stretch',
        '$opportunities','$polite','$ideas','$deadline','$supported','$duties')";
    /*execute multi_query*/
mysqli_multi_query ($link, $insert_query);/*error1*/
/*close connection*/
if(!$link>connect_errno) $link->close(); /*error2*/
?>
数据既来自写入的表单(最后一个表单),也来自先前表单的会话。但是,我也收到此错误:警告:mysqli_multi_query() 期望参数 1 为 mysqli,Warning: mysqli_close() expects parameter 1 to be mysqli而过去几天我一直坚持这一点!先感谢您。