| | |
Pulling images from database
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
Hi,
For debugging purposes I would do something like what Anthony is suggesting.
I would locate an image in the images directory, say G493075_101_12.jpg, and find it's database ID ... then in a simplified PHP script (in the same directory as the one you are working on), I would write the image tag statically and also immediately following I would call just that image from the database ...
Here see if either show up, if the static one shows but the DB one does not then look at the source of the resultant page and see what the image-source is that is different from the static one. Possibly you are not getting results from your DB query. If neither images shows then ... then check back here and let us know what you did show up.
We're trying to find where the code is breaking, is it the database not producing results, is it the path to the image in the image directory somehow getting corrupted so it doesn't actually point to an image, is there something else going on ... we need information to figure this out.
For debugging purposes I would do something like what Anthony is suggesting.
I would locate an image in the images directory, say G493075_101_12.jpg, and find it's database ID ... then in a simplified PHP script (in the same directory as the one you are working on), I would write the image tag statically and also immediately following I would call just that image from the database ...
php Syntax (Toggle Plain Text)
$static = "website.com/images/main/G493075_101_12.jpg"; $dbase = $row_rs_listings['img_main']; // use actual specific DB call for that image ... print "<img src=\"$static\" />"; print "<img src=\"$dbase\" />";
Here see if either show up, if the static one shows but the DB one does not then look at the source of the resultant page and see what the image-source is that is different from the static one. Possibly you are not getting results from your DB query. If neither images shows then ... then check back here and let us know what you did show up.
We're trying to find where the code is breaking, is it the database not producing results, is it the path to the image in the image directory somehow getting corrupted so it doesn't actually point to an image, is there something else going on ... we need information to figure this out.
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
Finally, I realized what I had wrong: in the database, I was missing one folder for the path:
Thanks to everyone who helped me with this, I really appreciate it!
website.com/images/main/imagename.jpgThanks to everyone who helped me with this, I really appreciate it!
•
•
•
•
Finally, I realized what I had wrong: in the database, I was missing one folder for the path:
website.com/images/main/imagename.jpg
Thanks to everyone who helped me with this, I really appreciate it!
"Beneath this mask there is more than flesh. Beneath this mask there is an idea, Mr. Creedy, and ideas are bulletproof." - V
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: Upload image folder
- Next Thread: Showing a list from MySQL using WHERE isnt working :(
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





