<?php
include "db.php";
session_start();
$idnum=$_SESSION['updateidbutton'];
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "
";
}
else
{
// echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
@mysql_connect($host, $user, $pass) or die("Can not connect to database: ".mysql_error());
@mysql_select_db($db) or die("Can not select the database: ".mysql_error());
//$sql = mysql_query("select * from file");
$name=$_FILES["file"]["name"];
// echo $name;
$path = "upload/" . $_FILES["file"]["name"];
// echo $path;
date_default_timezone_set("Asia/Amman");
$date = date('y-m-d h:i:s', time());
$sql="UPDATE file SET name=$name,link=$path WHERE 'id-file'='$idnum';";
//echo $path;
// move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
@ mysql_query($sql) or die("Error in Query: " . mysql_error());
$msg='
Image successfully saved in database with id ='. mysql_insert_id().'
';
echo $msg;
}
?>
my errors Error in Query: Query was empty ( if i set mysql_query before update )
or
Error in Query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Template.doc,link=upload/WCSIT Template.doc
WHERE 'id-file'='24'' at line 1
تحديث للسؤال برقم 1
الخطا كان باسم cloum "id-file"
اعملتلو تعديل من قاعدة البيانات وخليتو idfile وشلت - من البرنامج فزبط ...
شكرا اخي