Jump to content

updating column leaves it blank.


thereaper87

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.