5 Replies - 31173 Views - Last Post: 10 February 2012 - 10:05 AM Rate Topic: -----

#1 asif33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 20-June 10

help in uploading image in phpmyadmin database

Posted 20 June 2010 - 10:09 AM

hello guys....i am having a problem in inserting image into phpmyadmin database using xampp. I am using longblob while specifying type....but i am not aware ehat to do next...your help would be gleefully accepted...thank you
Is This A Good Question/Topic? 0
  • +

Replies To: help in uploading image in phpmyadmin database

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: help in uploading image in phpmyadmin database

Posted 20 June 2010 - 10:18 AM

First and foremost show us the code you're using to accomplish this.

For the record, it's bad practice to store the actual image in your database. It uses unnecessary resources, and will put an even bigger load on your server every time and image has to be displayed. What you should do is store a link (the path) to the image in your table, then put the actual image in the file system of your site.
Was This Post Helpful? 2
  • +
  • -

#3 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2911
  • View blog
  • Posts: 10,080
  • Joined: 08-August 08

Re: help in uploading image in phpmyadmin database

Posted 20 June 2010 - 10:21 AM

The OP isn't using code. They're using phpMyAdmin to enter data into a table in the database. That's all well and good, but where they're messing up is that they are trying to enter pictures into the database! While that is possible, it is NOT recommended because it will slow the database down. Instead, save the path to the image.
Was This Post Helpful? 2
  • +
  • -

#4 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3715
  • View blog
  • Posts: 5,972
  • Joined: 08-June 10

Re: help in uploading image in phpmyadmin database

Posted 20 June 2010 - 05:44 PM

While I agree with PsychoCoder and CTphpnwb about this generally not being the ideal solution, here is how you use phpMyAdmin to add a file to a blob:

  • Select the database you want to use from the left menu bar.
  • Select the "Insert" Action on the table your BLOB is in.
  • Fill in the form. Use the "Browser" button to select the file for your blob.
  • Click "Go".

Voila!

Some visual-aids, if that wasn't clear enough:
Attached Image
Was This Post Helpful? 2
  • +
  • -

#5 gooner89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-February 12

Re: help in uploading image in phpmyadmin database

Posted 10 February 2012 - 09:56 AM

Im having problems with actually displaying the files, I have used phpmyadmin for the database, in the products table i have an image field, but i can't figure out how to display the image, i am trying to do it from the filesystem (not with the blob)

$prodsSQL="select prodId, prodName, prodPrice, prodPic 
from products
where catId=".$categoryId." 
order by prodId";

$execprodsSQL=mysql_query($prodsSQL) or die (mysql_error());

 

echo "<table>";
echo "<tr>";

echo "</tr>";

while ($prodsarray = mysql_fetch_array($execprodsSQL))
{
	echo "<tr>";
	echo "<td><a href=proddetailspage.php?prodid=".$prodsarray['prodId'].">";
	echo $prodsarray['prodName'];
	echo "</td>";
	echo "<td>GBP ".$prodsarray['prodPrice']."</td>";
	echo "<td>".$prodsarray['prodPic']."</td>";
	echo "</tr>";


Was This Post Helpful? 0
  • +
  • -

#6 gooner89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-February 12

Re: help in uploading image in phpmyadmin database

Posted 10 February 2012 - 10:05 AM

not to worry I've fixed it
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1