onthespot Posted August 18, 2009 Share Posted August 18, 2009 Hey guys, I have included num rows in my script. <?php $leagues = mysql_query("SELECT `comp_name`, `game`, `format` FROM `competitions` WHERE `comp_type` = 'league' AND format = 'xbox 360'"); $num_rows = mysql_num_rows($leagues); ?> <table cellspacing="10" width="300"> <tr> <td></td> <td></td> <td></td> </tr><? if ($num_rows > 0) { while( $row = mysql_fetch_assoc($leagues)) { extract($row); $info = explode("_",$row[comp_name]); ?> <tr> <td><A HREF="league.php?comp=<? echo $comp_name; ?>"><? echo $info[2]; ?></A></td> <td><? echo $info[1]; ?></td> <td><? echo $info[0]; ?></td> </tr> <? } ?> </table> <? } else { echo "There are currently no Xbox 360 Leagues"; } ?> Problem is that with the numrows in there, it messes my css up. So there must be a reason including it? Can you see anything that isn't what it should be? Link to comment https://forums.phpfreaks.com/topic/170901-solved-php-num-rows/ Share on other sites More sharing options...
bubbasheeko Posted August 18, 2009 Share Posted August 18, 2009 How is it messing up your css? Do you have a screen shot or an example to show? Link to comment https://forums.phpfreaks.com/topic/170901-solved-php-num-rows/#findComment-901388 Share on other sites More sharing options...
onthespot Posted August 18, 2009 Author Share Posted August 18, 2009 Basically, it just moves the div at the very bottom. But if I remove the num rows, it goes back to normal? Link to comment https://forums.phpfreaks.com/topic/170901-solved-php-num-rows/#findComment-901394 Share on other sites More sharing options...
MadTechie Posted August 18, 2009 Share Posted August 18, 2009 Problem is that with the numrows in there, it messes my css up. So there must be a reason including it? Can you see anything that isn't what it should be? HUh! I don't see any CSS and have no idea how mysql_num_rows would affect CSS.. I would assume you mean the table.. without see more code or knowing whats wrong i would have to guess and say move the open table tag into the if statement ie <?php $leagues = mysql_query ( "SELECT `comp_name`, `game`, `format` FROM `competitions` WHERE `comp_type` = 'league' AND format = 'xbox 360'" ); $num_rows = mysql_num_rows ( $leagues ); if ($num_rows > 0) { ?> <table cellspacing="10" width="300"> <tr> <td></td> <td></td> <td></td> </tr><?php while ( $row = mysql_fetch_assoc ( $leagues ) ) { extract ( $row ); $info = explode ( "_", $row [comp_name] ); ?> <tr> <td><A HREF="league.php?comp=<?php echo $comp_name; ?>"><?php echo $info [2];?></A></td> <td><?php echo $info [1]; ?></td> <td><?php echo $info [0]; ?></td> </tr> <?php } ?> </table> <?php } else { echo "There are currently no Xbox 360 Leagues"; } ?> Link to comment https://forums.phpfreaks.com/topic/170901-solved-php-num-rows/#findComment-901395 Share on other sites More sharing options...
onthespot Posted August 18, 2009 Author Share Posted August 18, 2009 That has solved it, thankyou very much! Link to comment https://forums.phpfreaks.com/topic/170901-solved-php-num-rows/#findComment-901399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.