|
||||||
| PHP Tutorials PHP Tutorials |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
It's very very simple.. so..First of all we must connect to our database PHP Code:
$password = ""; - It's your database's password $host = "localhost"; - It's your database's host, usually it's localhost but it can be something else also $database = ""; - It's your database Now let's connect to the database PHP Code:
@mysql_select_db($database) or die("Can not select the database: ".mysql_error()); - This will select your database Now let's get our id PHP Code:
So.. your id will be 3 and it will show an image which id is 3 PHP Code:
die("Please select your image!"); - lets display an error }else{ - But if it is set let's continue with showing our image ![]() PHP Code:
$row = mysql_fetch_array($query); - Let's gather our info about image which id is $id into one variable $content = $row['image']; - Get's the blob from our table Now let's display our image PHP Code:
echo $content; - This will display our blob.. } - Ends else Okay.. now here's our full script. PHP Code:
![]() ![]() Enjoy ![]() If you have questions then please feel free to ask ![]()
__________________
![]() CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | Freelance Cheap & Professional Web Design | Need help? Send a PM Last edited by Jordan; 05-07-2008 at 12:02 PM.. |
|
|||||
you're welcome
__________________
![]() CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | Freelance Cheap & Professional Web Design | Need help? Send a PM |
|
|||
|
Jaan, I loved your easy to follow instructions but I want to do something slightly different. I have a MySQL db and want to display a Blob image from it into a table populated by PHP. I have a MySQL query which selects all records from the database and then displays the text content from each record on a row in the table. I want one of the table cells in each row to display the blob image. How do I do this? Regards CG |
|
|||||
|
I believe.. then you should create a real images from those blobs.. use this tutorial to create those images: http://forum.codecall.net/php-tutori...files-php.html there.. this blob will be this $content.. so replace it.. and then.. after your script ends.. just delete those images.. then just use PHP Code:
PHP Code:
![]() i believe it works
__________________
![]() CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | Freelance Cheap & Professional Web Design | Need help? Send a PM |
|
|||||
|
Well, great tutorial. +rep
__________________
WTemplates - web templates, free templates | CodeCall CooL! |
|
|||
|
Hi everybody, sorry with my english... this is my first post here.... i hav a question ¿how ill show all images from my DDBB where i hav user ID? this tutorial show just 1 images ....but if i hav a lot of picture and i need to show all of the USER ID x? im trying to do a while but i cant do this work Some Help? Thanks |
|
|||
|
i have a script to show thumbnails in table but the image become corrupted in the net.. how would i solve this problem?? please help me thank you |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: Storing Images in MySQL with PHP | Jordan | PHP Tutorials | 23 | 06-02-2009 10:01 PM |
| Tutorial: PHP to MySQL | Jordan | PHP Tutorials | 9 | 09-05-2008 12:12 PM |
Algorithms and Data Structures
Programming Language Popularity
Code Collaboration
Podnet IRC Network
AmpHosted
Goal #1: 1,000 Blogs
Goal #2: 1,000 Wiki Pages
Goal #3: 300,000 Posts
Goal #4: 20,000 Threads
Done: 30%, 23%, 55%, 75%