storing image_id after uploading image in article table

Posted by Bader on Stack Overflow See other posts from Stack Overflow or by Bader
Published on 2010-03-24T14:24:32Z Indexed on 2010/03/24 14:33 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

According to this question i successed to create upload image , but now i need to store the image_id to another table called articles , i do not know if this is correct , but i tried to select the image_id from table image like this

$select_image=mysql_query("select image_id from image where image_name = $fileName") or die(mysql_error());

and fetch the result to my article insert query like this

$fetch=mysql_fetch_array($select_image);

$qeuery=mysql_query("insert into articles (article_name,article_category,article_subcategory,article_body,article_summary,article_tags,article_photo,article_timedate) values ('$article_title','$CategoryID','$ProductID','$article_body','$article_summary','$fetch[image_id]','$time')") or die ('Error, Query Faild'.mysql_error());

is this correct ? the mysql_error keeps saying " Unknown column 'Penguins.jpg' in 'where clause'"

© Stack Overflow or respective owner

Related posts about php

Related posts about image