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.
GET statement?
Moderator: General Moderators
- Ixplodestuff8
- Forum Commoner
- Posts: 60
- Joined: Mon Feb 09, 2004 8:17 pm
- Location: Queens, New York
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
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
Code: Select all
<?php
$sql = "SELECT * FROM [your users table] WHERE [row with the usernames] = '" . addslashes ( $_GET['user'] ) . "' ";
?>