Storing Image in database and how to add comment

  • joy1986joy
  • Novice
  • Novice
  • User avatar
  • Joined: Jul 04, 2010
  • Posts: 27
  • Status: Offline

Post October 10th, 2010, 11:44 pm

Hi all,
Like every time this time also I need your precious help. I need to know that how can I store Image, delete Image or update Image by sql query in PHP code.

Also need some help in coding of commenting. Like there is a article and the visitors can comment on that article which is visible to all. Like forum commenting.

Also need help about getting payment from people by their credit cards or gift cards. I got the code for getting payment in paypal. But I don't get the code for getting payment online by cards. Google checkout is not working for me because I am not from US or UK.

Please help me with the code or where I can found those codes and a good tutorial on it.
Thanks in advance for your help and support.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 10th, 2010, 11:44 pm

  • this213
  • Guru
  • Guru
  • User avatar
  • Joined: Mar 01, 2004
  • Posts: 1242
  • Loc: ./
  • Status: Offline

Post October 11th, 2010, 3:49 am

For your 1st question (make $i whatever your file field name is):
PHP Code: [ Select ]
$fileName = $_FILES[$i]['name'];
$tmp_name = $_FILES[$i]['tmp_name'];
$file_size = $_FILES[$i]['size'];
$file_type = $_FILES[$i]['type'];
 
$fp = fopen($tmp_name,'r');
$file_content = addslashes(fread($fp,filesize($tmp_name)));
fclose($fp);
  1. $fileName = $_FILES[$i]['name'];
  2. $tmp_name = $_FILES[$i]['tmp_name'];
  3. $file_size = $_FILES[$i]['size'];
  4. $file_type = $_FILES[$i]['type'];
  5.  
  6. $fp = fopen($tmp_name,'r');
  7. $file_content = addslashes(fread($fp,filesize($tmp_name)));
  8. fclose($fp);


The binary of the uploaded file is now in $file_content, just insert that into a BLOB type MySQL column like you would anything else.

From the questions you're asking, I suggest you spend some time on http://php.net and http://dev.mysql.com and familiarize yourself with the technologies you're trying to use. Also, it's proper to have 1 question per thread so others may find solutions to their similar problems easier. I'm reading this as "how do I upload images to a database?", "How do I write blogging software?" and "How do I interface with the payment gateway of my choosing?".
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Joined: May 21, 2004
  • Posts: 3229
  • Loc: South Africa
  • Status: Offline

Post October 11th, 2010, 6:19 am

Had this question so many times in the past wrote a tutorial

http://www.rabiddog.co.za/tutorial.php? ... usingMySQL

Are we still allowed to do that? Post external links?
Watch me grow
  • joy1986joy
  • Novice
  • Novice
  • User avatar
  • Joined: Jul 04, 2010
  • Posts: 27
  • Status: Offline

Post October 17th, 2010, 8:44 pm

@Rabid Dog
Thanks for the link and wonderful tutorial. Its worked for me well and good.
I did not find my other answers. For that as per the suggestion of this213 I am starting two new thread by dividing this thread.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 243 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.