how to link image using PHP Programming language?
how can i link an image using PHP Programming language by looping statement. ea. i have a table with 4 rows and 5 cols with images thumbnails with link..
Public Comments
- don't know the names of the table and rows but: <?php // Make a MySQL Connection $query = "SELECT image FROM images"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo '<img src="'.$row['image'].'">'; echo '<br>'; } ?> contact me and tell me the details of your table.
- That above will show the images retrieved from the DB, but will not link them! Add: echo ("<a href=xxx>" <img.... > "</a>");
- $sql=mysql_query("select * from tablename"); while($row=mysql_fetch_array($sql)){ echo "<a href='image link here'><img src='folder path/".$row['image name']."'></a>"; } in this PHP code use your table structure for 4 rows and 5 cols
Powered by Yahoo! Answers