我得到以下错误:
警告:mysql_connect()[function.mysql connect]:第2行/home/a5467268/public_html/andrew/fileupload.php中的用户“a5467268_andrew'@'10.1.1.19'(使用密码:yes)被拒绝访问
警告:mysql_select_db():提供的参数不是第3行/home/a5467268/public_html/andrew/fileupload.php中的有效mysql链接资源

<?php
$con=mysql_connect("","","");
mysql_select_db("login",$con);
extract($_POST);

$target_dir = "test_upload/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

if($upd)
{
//$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$imageFileType= $_FILES["fileToUpload"]["type"];

if($imageFileType != "video/mp4" && $imageFileType != "video/avi" && $imageFileType != "video/mov" && $imageFileType != "video/3gp" && $imageFileType != "video/mpeg")
{
    echo "File Format Not Supported";
}
else
{
$video_path=$_FILES['fileToUpload']['name'];
mysql_query("insert into video(video_name) values('$video_path')");
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],"test_upload/".$_FILES["fileToUpload"]["name"]);
echo "uploaded ";
}
}
?>
<form method="post" enctype="multipart/form-data">
Choose Video<input type="file" name="fileToUpload"/>
<input type="submit" value="uplaod" name="upd"/>
</form>

最佳答案

警告:mysql_connect()[function.mysql connect]:拒绝访问
用户'a5467268'u andrew'@'10.1.1.19'(使用密码:是)
/主页/a5467268/public_html/andrew/fileupload.php,第2行
当您为不存在的数据库用户使用密码时,会发生这种情况。
试试这个:

mysql_connect('server_name','db_user','db_user_password');

10-07 23:11