vet911 Posted April 27, 2011 Share Posted April 27, 2011 I'm having trouble with my script. I'm getting pictures from the database and showing it in 3 columns and putting some information in each table location with the picture. But I made a change and now the table still works but I get a full blank page and have to scroll down to see the pictures. Can anybody see where my problem exists, it was working fine but now it doesn't. Any help would be appreciated. Thanks in advance. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <title></title> <head> <link rel="stylesheet" href="./stylesheet/stylesheet1.css" media="screen"> <style type="text/css" media="screen">@import url("./stylesheet/stylesheet2.css");</style> </head> <body> <center><table cellspacing="5" cellpadding="5" width="800" border="1"> <?php include "connect.php"; $query = "SELECT * FROM promo_vet ORDER BY year"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 3; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product ALIGN='CENTER' if($year != "" && $year != null) echo "<td align='center'><a><img src=\"$picture\"></a><br>$testshot<FONT COLOR='red'><b>$year</b></FONT><br>$description <br> $boxno<br>$convertible<br>$coupe </td><BR>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table></center> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/234914-i-need-some-help-with-this-script-cant-seem-to-find-the-problem/ Share on other sites More sharing options...
cssfreakie Posted April 28, 2011 Share Posted April 28, 2011 I don't see anything here that could cause a big white space above your table. But than again I am not sure what you have in your stylesheet what may very well say table{margin-top:600px;} or something. Do you maybe have it somewhere online so i can have a look. I think this is more a html css question than a php one. Also your using some bad tags (see my signature for a reference on that) and your pretty inconsistent with the use of <br> and <BR> have you tried to run the output of your page through a w3c validator also? Quote Link to comment https://forums.phpfreaks.com/topic/234914-i-need-some-help-with-this-script-cant-seem-to-find-the-problem/#findComment-1207294 Share on other sites More sharing options...
jcbones Posted April 28, 2011 Share Posted April 28, 2011 echo "<td align='center'><a><img src=\"$picture\"></a><br>$testshot<FONT COLOR='red'><b>$year</b></FONT><br>$description <br> $boxno<br>$convertible<br>$coupe </td><BR>"; <-break rule outside of table columns May help. Quote Link to comment https://forums.phpfreaks.com/topic/234914-i-need-some-help-with-this-script-cant-seem-to-find-the-problem/#findComment-1207309 Share on other sites More sharing options...
vet911 Posted April 28, 2011 Author Share Posted April 28, 2011 Jcbones you hit it right on the head, I removed the <br> and now it back to the top of the page. I must have put that in yesterday cause I didn't put it there today. Thanks to all who responded. Quote Link to comment https://forums.phpfreaks.com/topic/234914-i-need-some-help-with-this-script-cant-seem-to-find-the-problem/#findComment-1207319 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.