gpt4 book ai didi

php - 数据库错误代码 1146 - 本地与在线

转载 作者:搜寻专家 更新时间:2023-10-30 20:11:24 25 4
gpt4 key购买 nike

我是这个网站的新手 - 请温柔点:P

本地主机上的 mySQL 数据库适用于插入语句,但是一旦我将数据库连接更改为服务器连接,它就会给我错误:错误代码 1146:1146,没有任何错误描述。可能是什么原因?

根据我的错误捕获逻辑,连接成功一直到查询运行的部分。在本地版本上,它就像一个魅力。有什么想法吗?

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if($errors == 0)
{
$DBConnect = @mysql_connect("db.start.ca", "nokeekwe", "classifiedlol");
if($DBConnect === FALSE)
{
echo "<p>Unable to connect. " .
"Error code " . mysql_errno() . ": " .
mysql_error() . "</p>\n";
$errors++;
}
else
{
$DBName = "nokeekwe";
$result = @mysql_select_db($DBName, $DBConnect);
if($result === FALSE)
{
echo "<p>Unable to select DB. " .
"Error code " . mysql_errno($DBConnect) .
": " . mysql_error($DBConnect) .
"</p>\n";
$errors++;
}
}
}

if($errors > 0)
{
echo "<p>Please use your browser's BACK button" .
" to return to the form and fix your errors.</p>\n";
}


if($errors == 0)
{

$title = stripslashes($_POST['title']);
$desc = stripslashes($_POST['desc']);
$req = stripslashes($_POST['req']);
$employer = stripslashes($_POST['employer']);
$phone = stripslashes($_POST['phone']);
$fax = stripslashes($_POST['fax']);
$email = stripslashes($_POST['email']);
$address = stripslashes($_POST['address']);
$insertJob = "INSERT INTO tbljobs (jobTitle, jobDesc, jobReq, jobEmployer, jobPhone, jobFax, jobEmail, jobAddress) VALUES ('$title', '$desc', '$req', '$employer', '$phone', '$fax', '$email', '$address')";
$QueryResult = mysql_query($insertJob, $DBConnect); // Run the Query Now woohoo.
if($QueryResult === FALSE)
{
echo "<p>Unable to save your job. " .
" Error code " .
mysql_errno($DBConnect) . ": " .
mysql_errno($DBConnect) . "</p>\n";

//echo $insertJob;


$errors++;
}
else
{
echo "Job Lead Saved!";}
mysql_close($DBConnect);
}

非常感谢

最佳答案

错误 1146 表示您试图访问一个不存在的表。

http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html

确保您的数据库结构在本地和服务器系统上是相同的。

关于php - 数据库错误代码 1146 - 本地与在线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11053061/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com