Jump to content

image display from mysql


kuvini2003

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/107149-image-display-from-mysql/
Share on other sites

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

 

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.