0

I'm running a PTC website. I want to show the last member registered on my website. I tried the following query but nothing is shown on the page;

<? 
$mem = mysql_query("SELECT username FROM tb_users ORDER BY id DESC LIMIT 1"); 
?>
New Member: 
<? echo $mem; ?>
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Mujahid158
0

Hi Mujahid158 and welcome to DaniWeb

The mysql_query function returns a result set resource for select queries. You can't access it in the way that you are attempting, you need to specify the index of the resource. Like so:

echo $mem["username"];

For further information on the function, please see the documentation at www.php.net

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.