kuvini2003 Posted May 25, 2008 Share Posted May 25, 2008 hello friends, please help me 1) i am having a database in mysql with following fields(id ,name,desc,image blob). I already inserted records in the table.I want to display all the fields in the php page. i want to display all the fields in a table format and also i have another situation 2) I am storing 10 images in the folder( c:\xampp\htdocs\Mywebsite\images) I want to store the paths of the 10 images in a file named imagefile.txt I have to dispay the images in the PHP script as hyperlink. Please help me. thanks, avinash Quote Link to comment https://forums.phpfreaks.com/topic/107149-image-display-from-mysql/ Share on other sites More sharing options...
pocobueno1388 Posted May 25, 2008 Share Posted May 25, 2008 1) i am having a database in mysql with following fields(id ,name,desc,image blob). I already inserted records in the table.I want to display all the fields in the php page. i want to display all the fields in a table format All you need to do is select the information from the database, and use a while loop to display it all. EX <?php //select info from db $query = mysql_query("SELECT * FROM table"); //display it using while loop while ($row = mysql_fetch_assoc($query)){ echo $row['col']; } ?> You just need to add the table in there. 2) I am storing 10 images in the folder( c:\xampp\htdocs\Mywebsite\images) I want to store the paths of the 10 images in a file named imagefile.txt I have to dispay the images in the PHP script as hyperlink. Read these tutorials http://www.tizag.com/phpT/fileopen.php http://www.tizag.com/phpT/fileread.php Quote Link to comment https://forums.phpfreaks.com/topic/107149-image-display-from-mysql/#findComment-549351 Share on other sites More sharing options...
kuvini2003 Posted May 25, 2008 Author Share Posted May 25, 2008 thank you for the reply. <?php $con = mysql_connect("localhost","kuvini","kuvini"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("kuvini", $con);$result = mysql_query("SELECT * FROM info"); echo "<font size=2><table border='1'> <tr> <th>Name</th> <th>Image</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td>" . $row['image'] . "</td>"; echo "</tr>"; } echo "</table>"; I am getting binary value in that place . What should i do?. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/107149-image-display-from-mysql/#findComment-549355 Share on other sites More sharing options...
sasa Posted May 25, 2008 Share Posted May 25, 2008 you must setup another php file to add property header to your image data Quote Link to comment https://forums.phpfreaks.com/topic/107149-image-display-from-mysql/#findComment-549365 Share on other sites More sharing options...
kuvini2003 Posted May 29, 2008 Author Share Posted May 29, 2008 hi, Can u please guide me with how to add property header to php file?.. -thanks Quote Link to comment https://forums.phpfreaks.com/topic/107149-image-display-from-mysql/#findComment-553058 Share on other sites More sharing options...
sasa Posted May 30, 2008 Share Posted May 30, 2008 look http://www.weberdev.com/get_example-3688.html Quote Link to comment https://forums.phpfreaks.com/topic/107149-image-display-from-mysql/#findComment-553259 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.