Page 1 of 1

GET statement?

Posted: Sat Feb 21, 2004 7:29 pm
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.

Posted: Sat Feb 21, 2004 7:39 pm
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