friends
i,m making a page that retieve data from database and show them and these data include a picture for each one of them i could upload this pic with the data by a page in which i can insert data and this pic into database but when it is time to retrieve these data to be shown into this page i could show these data but each pic related to it,s specific topic was not retrieved to be shown beside it i can see a red ( X ) instead of the speific pic
so i need you to guide me to a tutorial by which i can follow to show mulitple pics retrieved from database
a snap shot of the page is included to see how do each pic look like
Thank you
problem with showing image gallery
-
- Posts: 2
- Joined: Sun Oct 28, 2012 12:13 pm
problem with showing image gallery
- Attachments
-
- this is how the pic looks like
- indexpage.jpg (234.38 KiB) Viewed 981 times
Re: problem with showing image gallery
could you post the code?
-
- Posts: 2
- Joined: Sun Oct 28, 2012 12:13 pm
Re: problem with showing image gallery
first i made a page called getimage.php and here is the code of it
second the image where i want to show the image is index.php
here is the code included into this page
<?php include ("config.php"); $id=addslashes(@$_REQUEST['id']); $image= mysql_query ("SELECT photo FROM tourism_news Where id=$id"); $row1 = mysql_fetch_assoc($image); $myimage= $row1['photo']; header("content-type:image/jpeg"); //$type ='content-type:'.$row1['imagetype']; $type ="content-type:".$row1['imagetype']; echo "<img src='$myimage' width='100' height='200'>"; //header($type); //echo $row1['photo']; echo "$myimage"; //echo <img src=\"$myimage\">; ?>
second the image where i want to show the image is index.php
here is the code included into this page
$get=mysql_query ("SELECT * FROM tourism_news order by id desc LIMIT $start , $per_page"); echo "<table border='1' width='100%' bordercolor='red'> "; while ($row = mysql_fetch_assoc($get)) { //$lastid=mysql_insert_id(); echo "<table border='1' width='100%' bordercolor='red'> "; echo" <tr align='right'>"; echo" <td align='right' height='22' width='50%' ></td> <td align='right' height='22' width='60%' background='titlebar.jpg' ><font color='white'><b> " .$row['topic']. " </b></font></td> "; echo" </tr>"; echo "<table border='1' width='100%' bordercolor='green'> "; echo"<tr><td align='right' width='70%' ><font color='black'> ".$row['summary']." <a href='show_this_news.php?id=".$row['id']."' title='".$row['topic']."'>التفاصيل</a>"; echo"</font></td><td align='right' rowspan='2' width='30%' >"; echo"<img src='getimage.php?id=".$row['id']."' width=200 height=140 />"; // echo <img src=\"$myimage\">; // echo"</td>"; echo" </tr>"; echo"<tr><td align='left' width='70%' ><font color='black'>".$row['date']." مضاف بتاريخ</font></td>"; echo" </tr>"; } ?> </tr> </table>
Last edited by Temor on Sun Oct 28, 2012 2:00 pm, edited 1 time in total.
Reason: Code tags
Reason: Code tags
Re: problem with showing image gallery
header("content-type:image/jpeg"); //$type ='content-type:'.$row1['imagetype']; $type ="content-type:".$row1['imagetype']; echo "<img src='$myimage' width='100' height='200'>"; //header($type); //echo $row1['photo']; echo "$myimage"; //echo <img src=\"$myimage\">;If $myimage contains the actual data of the image you don't want to output it in an img tag like that, so this section should be
header("Content-Type: image/jpeg"); echo $myimage;However, it would be worth considering storing the image as a file rather than in the database.