![]() |
User profile page
Ok, so I'm trying to code a user profile page. Pretty simple. All I need it to do is to get the user data, like username, maybe their email, join date. All the standard things. Anyways, the thing I'm having problems with is I need to select the row of the user by using $_GET. So my URL look like this "user.php?id=1". What I need to do is by using $_GET to find the user ID in the database then selecting that row and pulling the data I need from it. I'm having troubles selecting the row using the ID number. I'm not too MySQL savvy.
I have a column named `id`, `username`, and `email`. How do I select this by using the ID number and output it? |
SQL is very simple if you look at it. You just need to get familiar with the basic commands. Your query might look like so:
Code:
SELECT * FROM profiles WHERE id=1 |
This is what I have already. Is there no reason why this shouldn't work?
"SELECT * FROM `user` WHERE id='$id'" Where $id would be the ID number from $_GET. EDIT: Aha... I needed to use mysql_fetch_array. |
| All times are GMT. The time now is 09:33 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0