debuitls Posted August 8, 2009 Share Posted August 8, 2009 Hi, This is a bit basic but anyway.. I have a php cookie called “uname” that stores a username. I want to store this “uname” cookie value in a mysql database. When I run the page with below code I just get a HTTP 500 error. $username = $check["uname"]; $sql="INSERT INTO proposal (username) VALUES (‘$_COOKIE[“uname”]’)”; I’m new to php so just wondering if anyone could tell me if I’m going about this in the right way and if so what the problem with the above code is. Any help would be greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/169360-how-do-you-store-a-php-cookie-value-in-a-database/ Share on other sites More sharing options...
abazoskib Posted August 8, 2009 Share Posted August 8, 2009 Hi, This is a bit basic but anyway.. I have a php cookie called “uname” that stores a username. I want to store this “uname” cookie value in a mysql database. When I run the page with below code I just get a HTTP 500 error. $username = $check["uname"]; $sql="INSERT INTO proposal (username) VALUES (‘$_COOKIE[“uname”]’)”; I’m new to php so just wondering if anyone could tell me if I’m going about this in the right way and if so what the problem with the above code is. Any help would be greatly appreciated! try : $sql = "INSERT INTO proposal(username) VALUES('$username')"; $result = mysql_query($sql); Link to comment https://forums.phpfreaks.com/topic/169360-how-do-you-store-a-php-cookie-value-in-a-database/#findComment-893659 Share on other sites More sharing options...
debuitls Posted August 8, 2009 Author Share Posted August 8, 2009 Thats works fine! Big Help Thanks abazoskib Link to comment https://forums.phpfreaks.com/topic/169360-how-do-you-store-a-php-cookie-value-in-a-database/#findComment-893686 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.