Why doesn't this piece of php code work?
Posted
by
Sam Gabriel
on Stack Overflow
See other posts from Stack Overflow
or by Sam Gabriel
Published on 2010-12-31T08:35:58Z
Indexed on
2010/12/31
8:53 UTC
Read the original article
Hit count: 270
Hey guys, I have a mysql database which stores an id for each picture, as well as the picture's url and its thumbnail url. the thumbnail url is something like thumbs/pic.jpg and the page I'm creating has the folder thumbs in the same place it is created. But when I run this piece of code, nothing shows up:
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
mysql_connect("localhost", "***", "***") or die(mysql_error());
mysql_select_db("pics") or die(mysql_error());
$results = mysql_query("select id from classpics") or die(mysql_error());
$data=mysql_fetch_array($results);
foreach($data as $uno) {
echo '<td valign="middle" align="center"><a class="neutral" href="../images.php?id=' . $uno['id'] . '"><img src="'. $uno['thumbs'].'" border="0" /></a></td>';
}
?>
© Stack Overflow or respective owner