DigiplayStudios
09-25-2010, 02:10 PM
Okay,
So I have a page named profile.php which displays any users profile page with some of their details (grabbed from the MySQL database).
I have at the top of the profile.php page the following code:
<?php
include 'dbc.php';
$id = $_GET['id']; // get var from URL
$result = mysql_query("SELECT * FROM users WHERE id = $id");
$row_settings = mysql_fetch_array($result);
?>
So when I go to a page like profile.php?profile.php?id=1 for example it would then display the profile details for the user with ID number 1 in the MySQL database.
However, I want to be able to do that with the field 'user_name' in my MySQL table. So something like, profile.php?profile.php?user_name=ed and it finds the details for the user with the user_name matching 'ed'. How do I do this? It doesn't seem to work if I simply change all the details to user_name.
So I have a page named profile.php which displays any users profile page with some of their details (grabbed from the MySQL database).
I have at the top of the profile.php page the following code:
<?php
include 'dbc.php';
$id = $_GET['id']; // get var from URL
$result = mysql_query("SELECT * FROM users WHERE id = $id");
$row_settings = mysql_fetch_array($result);
?>
So when I go to a page like profile.php?profile.php?id=1 for example it would then display the profile details for the user with ID number 1 in the MySQL database.
However, I want to be able to do that with the field 'user_name' in my MySQL table. So something like, profile.php?profile.php?user_name=ed and it finds the details for the user with the user_name matching 'ed'. How do I do this? It doesn't seem to work if I simply change all the details to user_name.