GET statement?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bumple
Forum Commoner
Posts: 34
Joined: Thu Jan 08, 2004 4:38 am

GET statement?

Post by bumple »

Hey all...

Let's say I have a user signed up at my site with the username gyro, and they visit http://www.site.com/hello.php?user=gyro . How would I fetch all of gyro's information in the database using a $_GET statement?

Thanks a lot guys!
-Anonymous.
User avatar
Ixplodestuff8
Forum Commoner
Posts: 60
Joined: Mon Feb 09, 2004 8:17 pm
Location: Queens, New York

Post by Ixplodestuff8 »

If I understood correctly you don't need to use $_GET to get stuff from a database. you would use $_GET to get the username, somthing like this

Code: Select all

<?php

$sql = "SELECT * FROM [your users table] WHERE [row with the usernames] = '" . addslashes ( $_GET['user'] ) . "' ";

?>
also it is a security problem to blindly have a $_GET variable in an sql statement, so it's wise to use addslashes() around it
Post Reply