TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 11-06-2009, 11:52 AM   #1 (permalink)
The Acquainted
 
Dave's Avatar
 
Join Date: Apr 2008
Posts: 110
Thanks: 97
Dave is on a distinguished road
Default <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
Dave is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Answer Then PHP Question codefreek The Lounge 14 07-20-2009 07:19 PM
question about ftp kritikal General 3 04-28-2008 03:21 PM
$_SERVER['REQUEST_URI'] question solistus General 4 04-01-2008 09:31 PM
Cleaning data before entering database question Killswitch General 7 12-24-2007 11:29 PM
Important Database Structure Question! AnthonyOS MySQL & Databases 5 12-20-2007 03:26 PM


All times are GMT. The time now is 12:07 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design