查询未插入mysql

问题描述 投票:0回答:1

您好,下面是我上传表单的完整代码,但是我似乎无法理解为什么我的查询没有被插入到mysql中。我正在使用PHP 5.1

**<?php
include("includes/function.php");
connectme();
#error_reporting(0);
$filename = $_FILES[image][name];
$time=time();
if (move_uploaded_file($_FILES['image']['tmp_name'], 'files/' . $_FILES['image']['name'])) {
$x=mysql_query("INSERT INTO files SET link='".$filename."', timez='".$time."'");
if($x){echo "Inserted Into databse<br/>";}else{echo "Failed to Store In Databse<br/>";}

echo "Successfully Uploaded..! <br/><input name=\"myUploadedLink\" value=\"/files/$filename\">";
} else {
    echo 'Error in file upload.';
}
?>**
php mysql upload
1个回答
0
投票

所以基本上您的插入查询语句是错误的,请尝试使用

mysql_query("INSERT INTO files (link, timez) VALUES ('".$filename."', '".$time."')")

希望这可能会有所帮助。干杯

© www.soinside.com 2019 - 2024. All rights reserved.