开发者

how to run sql query after image upload in php when i am using flash uploader for multiple file uploading

开发者 https://www.devze.com 2023-01-18 18:23 出处:网络
I am using library to upload multiple images in php .This library use flash file and a php file . All things are working but problem is that I want to run a query after each image is uploaded to store

I am using library to upload multiple images in php .This library use flash file and a php file . All things are working but problem is that I want to run a query after each image is uploaded to store image detail in database . If i write query in php file after uploading code then It upload images but no error given and no image details are put in database.

Can any one help me that how I add image details in database after uploading image using flash uploader This is my code

<?
 extract($_GET);

 $filename = $_FILES['Filedata']['name'];
 $temp_name = $_FILES['Filedata']['tmp_name'];
 $error  = $_FILES['Filedata']['error'];
 $size  = $_FILES['Filedata']['size'];

 /* NOTE: Some server setups might need you to开发者_C百科 use an absolute path to your "dropbox" folder
 (as opposed to the relative one I've used below).  Check your server configuration to get
 the absolute path to your web directory*/


 if(!$error){

  copy($temp_name, '../dropbox/'.$filename);
  $news_query="insert into tbl_news(img_id,headline,caption,news_catgory_id,shooting_date) Values('0000','News_Headline','News_Caption',
  'New_Category','now()')";
  mysql_query($news_query) or die(mysql_error()); 
}
?>

all code working but query data is not updated in database


May be it's a sql error...if your "shooting_date" field is numeric or date, you can't set it's value like this: 'now()', you must strip the quotes.

0

精彩评论

暂无评论...
验证码 换一张
取 消