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
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

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.