Jump to content

MySQL Update not working for 1 value, but working with other values


monkeyj

Recommended Posts

When I echo the POST, it echoes the correct value.

The MySQL portion seems to just ignore it all together.

I've tried changing the dropdown option to just a text field, same thing occurred.

I have text fields right above this particular one that update just fine with the SAME exactly scripting.

if POST, update query, done. Works.

 

This one for some reason will not.

 

MySQL portion:

			if ($_POST['bUpdate']){
			mysql_query("UPDATE `Patients` SET `b` = '$_POST[bUpdate]' WHERE `id` = '".$_GET['id']."'");
		}
echo $_POST['bUpdate'];

 

Form Portion:

    <tr onmouseover="color(this, '#baecff');" onmouseout="uncolor(this);">
    <td width="310" colspan="2" align="center"><span class="fontoptions">Postcard Status </span><br />
<?
if ($data['b'] == 1){
	echo '<select name="bUpdate"><option value="1" selected>Yes</option><option value="0">No</option></select>';
} else {
	echo '<select name="bUpdate"><option value="1">Yes</option><option value="0" selected>No</option></select>';
}

?>
</td>
    </tr>

Link to comment
Share on other sites

Figured it out.

It theoretically was supposed to work everytime.

The problem I had was putting it under a if($_POST) because the item will ALWAYS be posted for a radio button.

Regardless, I removed the if($_POST) command and just told it to Update it regardless of any 'change'...

and it detects it just fine.

 

Thanks BlueSky, cause during the debug, I put a line of code OUTSIDE the if command and it changed. :)

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.