
Originally Posted by
rpope904
So.. In your script, locate the
WHERE moose1137 * *
part is, and make sure the database column is infact, moose1137.
I see the problem actually.
Code:
function updateUserField($table, $username, $field, $value){
$q = "UPDATE $table SET $field = $value WHERE username = $username";
return mysql_query($q, $this->connection);
}
username = $username; you need some quotes or single quotes on that. Whats happening is $username IS being turned into moose1337 like it's supposed to.
But without quotes, MySQL thinks you're trying to update the username field with the contents of the column moose1337.
Try this:
$q = "UPDATE $table SET $field = $value WHERE username = '" . $username . "';";
I know thats some ugly code, but what it boils down to is those quotes by $username - they're actually single quotes with a double right after them, like this:
' " . $username . " '
The space is in there to show theres a single before the double, do NOT include the space or you'll have an extra space at the beginning and end of the username!
That will turn your query into:
UPDATE table SET field=value WHERE username = 'moose1337'
Which is what you want 
Edit: FYI my php might be a bit rusty. If I'm right, using " . $username . " should basically have PHP put the value of $username into the string. Try it with just '$username' and see if that works too, cause it'll save typing if it does 
In any case, the general idea should be right - MySQL needs some quotes so it knows moose1337 is a value, not a column name.