PDA

View Full Version : Echo, Print?


student101
07-15-2008, 08:19 PM
I found this useful piece of code;
I was wondering how to print what I need to print on the screen?
<?php
$sql = "SELECT * FROM Photos";
$sql1 = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($sql1) > 0)
{
$i = 0;
echo '<table border="1">'."\n";
while($result=mysql_fetch_array($sql1))
{
if($i % 3 == 0) echo '<tr>'."\n";
echo '<th scope="col"><img src="photos/'.$result['Filename'].'"></th>'."\n";
$i++;
if($i % 3 == 0) echo '</tr>'."\n";
}
echo '</table>';
}
?>
My needs are here:
<?php
$sql = $query_rsnav1;
$sql1 = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($sql1) > 0)
{
$i = 0;
echo '<table border="0">'."\n";
while($result=mysql_fetch_array($sql1))
{
if($i % 1 == 1) echo '<tr>'."\n";

//start problem area

echo '<th scope="col"><a href="?catid=<?php echo $_GET['catid']; ?>&img=<?php echo $row_rsnav1['image']; ?>&navid=<?php echo $row_rsnav1['intid']; ?>"><img src="uploads/<?php echo $row_rsnav1['thumb']; ?>" alt="" width="100" border="0"/></a></th>'."\n";

//end problem area

$i++;
if($i % 1 == 1) echo '</tr>'."\n";
}
echo '</table>';
}
?>

student101
07-15-2008, 09:47 PM
It seems as if it's fixed - but iframes is a no go.
echo '<th scope="col"><a href="?catid=' . $_GET['catid'] . '&img=' . $result['image'] . '&navid=' . $result['intid'] . '"><img src="uploads/' . $result['thumb'] . '" alt="" width="100" border="0"/></a></th>'."\n";

Cheers