Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: mysql ****

  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts

    mysql ****

    PHP Code:
    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 but i need 7 so my site wont go bugged

  • #2
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    You could fix the css styling to allow any number maybe (probably best)

    Code:
    #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 Code:
    <?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.
    Last edited by timgolding; 03-26-2009 at 01:58 AM.
    You can not say you know how to do something, until you can teach it to someone else.

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by timgolding View Post
    You could fix the css styling to allow any number maybe (probably best)

    Code:
    #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 Code:
    <?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?

  • #4
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    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=ht...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
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •