MYSQL/PHP HELP. SESSION VARIABLE STORED IN A DATABASE TABLE.?

  • Thread starter Thread starter Wes D
  • Start date Start date
W

Wes D

Guest
I am working on a system where a user can update content in the database, to be shown on a webpage.

I have a table for users, and a table for the content of the website.

My users table looks like this:
username---password---authorization code--
abc----|----123----|--adf519e81adf108g96e-----|
def-----|----456----|--asd96f498i409681dfes----|
---------------------------------------------------------------
my content table looks like this:
ID----Text------------- authorization code------------
1--|--blah blah blah------|--adf519e81adf108g96e----|
2--|--blah2 blah2 blah2-|-asd96f498i409681dfes----|
---------------------------------------------------------------------------------------------
I need this to happen: When a user logs into the system to edit their content, I want to secretly set their authorization code as a session variable along with their username and password.
When they go to the update form, the query executed is as follows:
"UPDATE Texts SET Text=$Text WHERE authorization_code=$_SESSION['authorization_code']"

The page processes all the data and junk, but when I check to see if the database itself has been updated, the website content that is, it is the same as it was before the update. In other words, the content is not being changed.

I think the problem may be in the registering the authorization code session secretly. This is how I have it working, well... the lack thereof, now:
$stip=username=$_SESSION['username'];
$query="SELECT authorization_code FROM Texts WHERE $stip;
$result=mysql_query($query);
$_SESSION['authorization_code'] = $result

If you need more details, PLEASE TELL ME! I am on a deadline and I have no idea what to do!
THANK YOU VERY MUCH!!!! Any and all help is appreciated.
 
Back
Top