0
我已經寫出了腳本,它似乎在我的測試服務器上工作得很好,但是當我嘗試在我的活服務器上使用它時,它不會插入sql信息進入桌子。簡單的上傳表單不把相關信息放入SQL表
這裏的腳本:
mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
mysql_select_db("$db_name")or die("cannot select DB");
$title=$_POST['title2'];
$description=$_POST['description'];
$uploaded = $_POST['uploaded'];
$target = "../../projects/forms/";
$target = $target . basename($_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename($_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
$result=MYSQL_QUERY("INSERT INTO $tbl_name(title, description, target) ". "VALUES ('$title', '$description', '$target')");
$id= mysql_insert_id();
print "File ID: <b>$id</b>";
print "Title: <b>$title</b>";
print "Description: <b>$description</b>";
print "File Name:</b>$target";
print "To upload another file Click Here<br>";
如果在查詢後調用mysql_error(),那麼mysql會向您報告什麼錯誤? – Ass3mbler 2011-01-13 16:25:29