Re: Simple Display

From: Date: Fri, 08 Feb 2002 18:53:15 +0000
Subject: Re: Simple Display
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16710@lists.php.net to get a copy of this message
At 7:46 +1300 2/9/02, Barry Rumsey wrote:
I am trying to do a simple fetch of the lastest add name. I have the following code : $query = "SELECT name FROM name ORDER BY name DESC LIMIT 1"; $latename = mysql_query($query) or die("Select Failed!"); $latename = mysql_fetch_array($latename);
echo "<b>Lastest Name Added:</b>  $latename    "
I know I am doing something wrong as being new to php it get be confused. It returns : Lastest Name Added: Array Could someone please point out where i'm going wrong
You've fetched an array, and you're trying to print the array itself, not a member of the array. Perhaps you want:
echo "<b>Lastest Name Added:</b>  $latename[name]    "
Or:
echo "<b>Lastest Name Added:</b>  $latename[0]    "
I suppose you might also mean "Latest" rather than "Lastest"... :-)
Thank you


« previous php.db (#16710) next »