...

View Full Version : mysql ****



Pandabeer
03-26-2009, 12:19 AM
Print "<table border cellpadding=4>";
Print "<th>Name:</th> <th>Reason:</th> <th>Admin that banned</th> <th>Date:</th></tr>";
while($a = mysql_fetch_array($sql))
{
Print "<th>".$a['name'] . "</th> <th>".$a['reason'] . "</th> <th>".$a['admin'] . "</th> <th>".$a['date'] . "</th></tr> <br />";
$aantal++;
}
if ($aantal <= $perpage)
{
$lol = $aantal;
$lol2 = $perpage;
while($lol < $lol2-$aantal)
{
Print "<th>None</th> <th>None</th> <th>None</th> <th>00-00-0000</th></tr> <br />";
$lol++;
}
}
Print "</table><br />";

can't get this to work it only shows 6 tablets in the second page

Click here to see the test (http://stats.roleplayandstunt.eu/bans.php?p=1) but i need 7 so my site wont go bugged

timgolding
03-26-2009, 02:52 AM
You could fix the css styling to allow any number maybe (probably best)



#stretch {background-image:url(swish_stretch.jpg); width:1000px; height:100%; position:absolute; top:496px; left:0px;background-repeat:no-repeat;}

It was your stretch div that is interfering. It just needs the no repeat like the others. Firebug is a cool tool you should get it told me what the problem was.

or fill in the rest blank something like.



<?php
Print '<table border="1" cellpadding="4">';
Print "<tr><th>Name:</th> <th>Reason:</th> <th>Admin that banned</th> <th>Date:</th></tr>";
$i=0;
$perpage=7;
while($a = mysql_fetch_array($sql))
{
Print "<tr><td>".$a['name'] . "</td> <td>".$a['reason'] . "</td> <td>".$a['admin'] . "</td> <td>".$a['date'] . "</td></tr>";
$i++;
}
if ($i <= $perpage)
{
$j=0;
while($j < $perpage-$i)
{
Print "<tr><td>&nbsp;</td><td>&nbsp;</td>&nbsp;<td>&nbsp;</td>&nbsp;<td>&nbsp;</td>&nbsp;</td></tr>";
$j++;
}
}
Print "</table><br />";
?>


You need to initialize your count vars first. e.g. $i=0;
You should only use <th> tags on the top row of your table they are for table headings only the other cells should be <td>. Each row should also start with a <tr> and end with a </tr>. You do not need <br /> after </tr> New rows will automatically start on the next line. You can put &nbsp; in to put a space char into your cells that will keep them the same size as the other with borders etc.

I know you'll most likely use the css fix method. But you should look carefully at the example in the php fix method because it highlights some errors you should learn to correct.

Pandabeer
03-26-2009, 02:08 PM
You could fix the css styling to allow any number maybe (probably best)



#stretch {background-image:url(swish_stretch.jpg); width:1000px; height:100%; position:absolute; top:496px; left:0px;background-repeat:no-repeat;}

It was your stretch div that is interfering. It just needs the no repeat like the others. Firebug is a cool tool you should get it told me what the problem was.

or fill in the rest blank something like.



<?php
Print '<table border="1" cellpadding="4">';
Print "<tr><th>Name:</th> <th>Reason:</th> <th>Admin that banned</th> <th>Date:</th></tr>";
$i=0;
$perpage=7;
while($a = mysql_fetch_array($sql))
{
Print "<tr><td>".$a['name'] . "</td> <td>".$a['reason'] . "</td> <td>".$a['admin'] . "</td> <td>".$a['date'] . "</td></tr>";
$i++;
}
if ($i <= $perpage)
{
$j=0;
while($j < $perpage-$i)
{
Print "<tr><td>&nbsp;</td><td>&nbsp;</td>&nbsp;<td>&nbsp;</td>&nbsp;<td>&nbsp;</td>&nbsp;</td></tr>";
$j++;
}
}
Print "</table><br />";
?>


You need to initialize your count vars first. e.g. $i=0;
You should only use <th> tags on the top row of your table they are for table headings only the other cells should be <td>. Each row should also start with a <tr> and end with a </tr>. You do not need <br /> after </tr> New rows will automatically start on the next line. You can put &nbsp; in to put a space char into your cells that will keep them the same size as the other with borders etc.

I know you'll most likely use the css fix method. But you should look carefully at the example in the php fix method because it highlights some errors you should learn to correct.

thanks for that code but check the page page 1 is 'higher' than page 2 how can i fix that?

timgolding
03-26-2009, 07:07 PM
I've looked at your page and doesn't seem you haven't implemented my changes. Which is why its not working. I see you had tried something similar to method two but not how I showed you. I told you to only use only th on the top row and to use td for the other rows. Which you haven't done. I told you to put a tr at the start of each row which again you haven't done. Well infact you haven't done any of the things i suggested. So thats why its not working. Here is proof of why your page doesn't work.

http://validator.w3.org/check?uri=http%3A%2F%2Fstats.roleplayandstunt.eu%2Fbans.php%3Fp%3D2&charset=%28detect+automatically%29&doctype=Inline&group=0
So you see the reason your page doesn't work partly because you have 25 errors.

I have had another play and removed the div stretch from the page and fixing the table so its valid mark up. Then at least both pages will behave the same way. As in this example
http://82.153.163.251/temp/web/test3.htm



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum