Results 1 to 2 of 2

Thread: show last ten recoreds

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Posts
    87

    show last ten recoreds

    i wrote this code but all the time I get an error

    <?
    require ("admin/config.php");

    mysql_connect($server,$db_user,$db_pass);

    mysql_select_db($database) ;

    $news=mysql_query("select * from users order by ID desc limit
    0,10");

    while($art = mysql_fetch_array($news)){

    $name = ($art[age],1);

    echo $name;
    }
    mysql_close();

    ?>

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    It'd help if you'd tell us what line you're getting the error on, but I'm going to take an educated guess:

    Code:
    <?
        require ("admin/config.php");
    
        mysql_connect($server,$db_user,$db_pass); 
        mysql_select_db($database) ;
    
        $news = mysql_query("select * from users order by ID desc limit 0,10");
        while ($art = mysql_fetch_array($news)){
    
            $name = ($art[age], 1);
    
            echo $name;
        }
        mysql_close();
    
    ?>
    The line in bold just doesn't make sense. Did you leave out a function name?

    And your variable naming doesn't make sense either. $news turns to $art, and $art[age] turns to $name? Whaaat?

    You're also using some very bad coding practices, such as short tags and not putting the age in quotes.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width