dacoder96
01-31-2010, 01:53 AM
Hi, thanks for opening the thread!
I'm coding a blog site and for it to work I need to be able to get data from the database and use it. I need to be able to store information when a user log's in.
This is how it works;
- the user logs in and if the account exists then they are granted access and then some session variables are set.
- each user has a personal choice of what skin (theme) they wish to use, there choice is stored in the database. I need to be able to use the stored variable in the database and use it as a session variable.
This is the code I have so far... it doesn't seem to get the value
$query = "SELECT skins FROM accounts WHERE username=$myusername";
$result = mysql_query ($query) or die ('Cannot execute the query.');
$userSkin = mysql_fetch_array ($result);
$_SESSION['skin'] = $userSkin;
When I log in it just says Cannot execute the query. I'm guessing its in this line somewhere...
$query = "SELECT skins FROM accounts WHERE username=$myusername";
My column that the personal choice of the skin is store in is called 'skins'
the table that it is stored in is called accounts.
It is must appreciated if you could help me get it working. If anymore information is needed I will be glad to post it.
Thanks.
I'm coding a blog site and for it to work I need to be able to get data from the database and use it. I need to be able to store information when a user log's in.
This is how it works;
- the user logs in and if the account exists then they are granted access and then some session variables are set.
- each user has a personal choice of what skin (theme) they wish to use, there choice is stored in the database. I need to be able to use the stored variable in the database and use it as a session variable.
This is the code I have so far... it doesn't seem to get the value
$query = "SELECT skins FROM accounts WHERE username=$myusername";
$result = mysql_query ($query) or die ('Cannot execute the query.');
$userSkin = mysql_fetch_array ($result);
$_SESSION['skin'] = $userSkin;
When I log in it just says Cannot execute the query. I'm guessing its in this line somewhere...
$query = "SELECT skins FROM accounts WHERE username=$myusername";
My column that the personal choice of the skin is store in is called 'skins'
the table that it is stored in is called accounts.
It is must appreciated if you could help me get it working. If anymore information is needed I will be glad to post it.
Thanks.