MySQL Forums
Forum List  »  PHP

Display the DB column Grid view using PHP
Posted by: Hi Muthu
Date: March 31, 2010 10:18PM

Hi...

I wish to display the data's on grid view like,

Name Address Picture

M blah blah <Display the pic of "M">

S blah blah <Display the pic of "S">

I used the below code, but its display the datas on the name and address. Can't display the Image. Can anyone help.. pls...

<?php
<db connection code>
$query = "SELECT * FROM diary order by id asc";
$result = mysql_query($query);


while ($row = mysql_fetch_assoc($result)){
?>

<form name="theform" method="post">
<tr bgcolor=#DAE5E9>
<td align=left><?php echo $row["name"];?></td>
<td align=left><?php echo $row["address"];?></td>
<td align=left><?php echo $row["picture"];?></td>
</tr>

<?php }?>


In my understanding, can't show directly. So i tried the following.

-------------------------------------
show_img.php
-------------------------------------
<?php

<db connection>
//check to see if the id is passed
if(isset($_GET['id'])) {
$id=$_GET['id'];
$query = "select picture from diary where id=$id";
//echo $query;
$result = mysql_query($query);
$row = mysql_fetch_array($result);
{
$data = $row["image"];
}
echo $data;
}
?>

------------------------------------
list.php
------------------------------------

<?php
$query = "SELECT * FROM diary order by id asc";
$result = mysql_query($query);


while ($row = mysql_fetch_assoc($result)){
?>

<form name="theform" method="post">
<tr bgcolor=#DAE5E9>
<td align=left><?php echo $row["name"];?></td>
<td align=left><?php echo $row["addres"];?></td>

<td align=center><?php echo "<img src=\"show_image.php?id=".$row["id"]."\">"; ?></td>
</tr>


<?php }?>


Its not showing the picture. Any help appreciated.

Options: ReplyQuote


Subject
Written By
Posted
Display the DB column Grid view using PHP
March 31, 2010 10:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.