Storing Image in database and how to add comment

  • joy1986joy
  • Novice
  • Novice
  • User avatar
  • Posts: 27

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

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
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

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?
  • joy1986joy
  • Novice
  • Novice
  • User avatar
  • Posts: 27

Post 3+ Months Ago

@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 73 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.