Hey, I have a MySQL database with the table ‘users’, and I want to allow users to post a description.
I have a form on another webpage, and I am sure that it is working.
The problem is that, in the following code, I am using the variable $text to update the MySQL. And, when the user submits, the value will not update unless I actually create a specific value to set.
Please excuse the terrible coding. I just want to make it functional before I organize/secure it.
Any help is appreciated, thanks!
[php]
<?PHP session_start(); function upload() { $text = $_POST['description']; $userid = $_SESSION['user_id']; $con = mysql_connect("localhost","**********","****"); //I starred these on purpose if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("**********", $con); //I starred this on purpose mysql_query("UPDATE users SET description=$text WHERE user_id=$userid"); } if (isset($_POST['submit'])) { upload();} ?>[/php]