PDA

Click to See Complete Forum and Search --> : show last ten recoreds


the hater
Jul 12th, 2003, 12:11 PM
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();

?>

The Hobo
Jul 13th, 2003, 02:51 PM
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:

<?
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? :confused:

You're also using some very bad coding practices, such as short tags and not putting the age in quotes.