Allow users to update account
Posted: Mon May 16, 2011 10:45 am
I am trying to query info from a database to allow users to update their account. The error I am getting is: Unknown column 'Smith' in 'where clause'. "Smith" is the correct $last_name for the user
Code: Select all
$user_id = (isset($_GET['id'])) ? $_GET['id'] : '';
$last_name = (isset($_GET['name'])) ? $_GET['name'] : '';
$query = 'SELECT
username, first_name, last_name, email, company, user_type
FROM
site_user u JOIN site_user_info i ON u.user_id = i.user_id
WHERE
u.user_id = ' . $user_id . '
AND
last_name = ' . $last_name;
$result = mysql_query($query, $db) or die(mysql_error($db));