EX: picture 1 - no text
picture 2 -picture 1's text
picture 3 -picture 2's text.
I have been racking my brain on this and cant seem to match up the text with the picture. Is my loop wrong, or is my table id screwed up? Please help. CODE:
Code: Select all
extract($_GET);
extract($_REQUEST);
$user = "oprods";
$pass = "breakin";
$db = "pictures";
$table = $_REQUEST['table'];
$num_rows = @mysql_num_rows($result);
echo $num_rows;
for ($id = 1; $id <= 3; $id++ ) {
print '<TR>';
print '<TD width=33%><img src=getdata.php?id='.$id.'&table='.$table.' width=404 height=295></TD>';
print '<TD width=33%>'.$description.'</TD>';
print '<TD width=33%>'.$section.'</TD>';
print '</TR>';
$conn = @mysql_connect('localhost',$user,$pass) or die(mysql_error());
if(!is_resource($conn)) {
die("Error connecting to mysql.\n");
}
@mysql_select_db($db,$conn);
$sql = "SELECT * FROM $table WHERE id=$id";
$result = @mysql_query($sql,$conn)or die(mysql_error());
while ($newarray = @mysql_fetch_array($result, MYSQL_BOTH)) {
$description = $newarray['description'];
$section = $newarray['section'];
}
}
?>