11-06-2009, 11:52 AM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Apr 2008
Posts: 110
Thanks: 97
|
<a href...> question
The code below is from a simple social networking application that I'm studying (not interested in making a social network app, but the code is interesting to follow).
The table USERS has the following fields:
id (IDs are assigned in order of registration.)
username
PASSWORD
firstname
lastname
dob
gender
email
location
html
CODE
valid
lastlogin
Two questions:
1. Is it a good idea to use the same variable ($new) in each line below (although I'm sure that PHP doesn't care)?
2. I don't understand the last line (echo "Our...) at all. (Let's say that the last user to register is "Snicker.")
PHP Code:
<?php
$new = mysql_query("SELECT * FROM users WHERE valid='1' ORDER BY id DESC LIMIT 1");
$new = mysql_fetch_assoc($new);
$new = $new['username'];
echo "Our newest member is <a href='$new/'>$new</a><br>";
?>
Thanks,
Dave
|
|
|
|