Jump to content

[SOLVED] Database query help


herghost

Recommended Posts

Hi All,

 

Should be a simple one I hope, think I am just missing some logic somewhere.

 

I have this:

 

$query="SELECT user_id FROM forum_question WHERE username =" . $_SESSION['username'] ."";
$result=mysql_query($query) or die ("oh dear   " .mysql_error()) ;
while($rows=mysql_fetch_array($result))
{
$_SESSION['user_id'] = $rows['user_id'];
}

 

Which is just meant to set the session from a the users id in the database.

 

Now I am logged in as user 'admin', However I am getting the error 'oh dear Unknown column 'admin' in 'where clause'

 

However when I double checked my database, admin is definitly listed on a row and has posted a question.

 

What am I missing?

 

 

Link to comment
https://forums.phpfreaks.com/topic/175586-solved-database-query-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.