Topic: Getting a username with ID
Hi, I'm just messing around really trying to broaden my PHP skills (which are like next to nothing )
anyway, I'm just making a page which will display lots of things about a particular user ( i know that's on the profile but meh ) it is similiar to profile.php in the way that it uses id.
so stats.php?id=2 etc..
I grabe the ID:
$id = isset($_GET['id']) ? intval($_GET['id']) : 0; if ($id < 2) message($lang_common['Bad request']);
But I'm trying to run a query to the DB to get the username for this ID. I thought it was this:
$stats_name = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id='.$id);
Obviously not though, so could somebody help me please?
EDIT: Btw, when I use this query then use
<?php echo($stats_name) ?>
it returns " Resource id #13 "