thereaper87 Posted February 28, 2011 Share Posted February 28, 2011 Hello there. I have a small form the inputs a new message into the column 'status'. But when I insert the new text, it deletes whatever is already in the column and leaves it blank. It will never add the new text to the column. Here is the form: $status_sql=mysql_query("SELECT status FROM global"); $status_data=mysql_fetch_assoc($status_sql); echo '<br /><br />Current Status Message: '.$status_data['status'].'<br />'; echo '<form name="status" method="post" action="?page=panel&action=sdo"><input type="text" class="console" name="status"> <input type="submit" class="cbutton" value="Enter"></form>'; $status = mysql_real_escape_string($_POST['status']); $update=mysql_query("UPDATE global SET status='$status' WHERE id='1'") or die('Query: ' . $update . '<br />Failed with: ' . mysql_error()); echo '<br />Status changed to: '.$status.''; If you need more info, just let me know. Thank you a million! Link to comment https://forums.phpfreaks.com/topic/229084-updating-column-leaves-it-blank/ Share on other sites More sharing options...
MattDunbar Posted February 28, 2011 Share Posted February 28, 2011 Try this, on the line where the query should be happening: echo "UPDATE global SET status='$status' WHERE id='1'"; I'm curious to see if $status is being set. If not, and the query was "SET status='' WH..." that would at least help source the error. Link to comment https://forums.phpfreaks.com/topic/229084-updating-column-leaves-it-blank/#findComment-1180616 Share on other sites More sharing options...
thereaper87 Posted February 28, 2011 Author Share Posted February 28, 2011 I added the echo like you asked and it echo'ed out what I put into the form. UPDATE global SET status='asdsadsad' WHERE id='1' Link to comment https://forums.phpfreaks.com/topic/229084-updating-column-leaves-it-blank/#findComment-1180619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.