我收到错误(不是真正的错误,只是无法正常工作),我试图弄清楚它是否与我的 sql 连接有关。我与两个完全不同的数据库有 2 个单独的连接。
$dshost = "kjbkb";
$dsdatabase = "kjhk";
$dsusername = "hjgfytdf";
$dspassword = "jhv";
mysql_connect($dshost,$dsusername,$dspassword);
mysql_select_db($dsdatabase) or die( "Unable to select database");
$sql = "SELECT * FROM users WHERE `username` = '".$_POST['paydl']."'";
$cheeseburger = mysql_query($sql);
$res = mysql_fetch_array($cheeseburger);
$autobus_user = $res['id'];
mysql_close(); //close first connection
$db_host = "khgv";
$db_user = "trdstx";
$db_password = "txz";
$db_database = "gfxx";
mysql_connect($db_host, $db_user, $db_password) or die("Unable to connect to host");
mysql_select_db($db_database) or die( "Unable to select database");
$ASDFASDF = "SELECT * FROM `autobus` WHERE `user_id` = '".$autobus_user."' LIMIT 3";
$BobDoleDontNeedThis = mysql_query($ASDFASDF);
$resnumbatwo = mysql_fetch_array($BobDoleDontNeedThis);
mysql_close(); //close 2nd connection
我这样做对吗?为什么$resnumbatwo
返回错误?