我正在使用的代碼:PHP MySQL的不是讓我插入表
function insertV($deptx, $coursex, $secx, $isbnx,$titlex, $authorx,$usedpx,$newpx)
{
$sql = "INSERT INTO `$deptx` (`course`, `sec`, `isbn`, `title`, `author`, `usedp`, `newp`)
VALUES ('$coursex','$secx','$isbnx','$titlex','$authorx','$usedpx','$newpx')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
}
$dept = "ACCOUNTG";
$course = "340";
$sec = "101";
$isbn = "9780324651140";
$title = "FINANCIAL ACCOUNTING";
$author = "STICKNEY";
$usedp = "$129.75";
$newp = "$199.75";
insertV($dept,$course,$sec,$isbn,$title,$author,$usedp,$newp);
但我不斷收到一個錯誤:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/public_html/mysite.com/myscript.php on line 14 Error:
我猜它與我做試圖訪問一個表使用var?
任何幫助,將不勝感激,我還是新的PHP,如果你不能告訴:P
編輯:噢,行14
if (!mysql_query($sql,$con))
Ahhhhh,這是有道理的。謝謝! – Sally 2010-08-10 15:33:31