Jump to content

Recommended Posts

When a user edits this form, all the fields get correctly updated except patient.  I also notice that a ' character gives me a syntax error even though I used mysql_real_escape_string!  That suggests something is fishy.

 

<a href = "displayactive.php">[RETURN TO ROUNDING LIST]</a>
<form action="commit.php"?action=<?php
	echo $_GET['action']; ?>&type=icu&id=<?php
	echo $_GET['id']; ?>" method="post">
        <table width="95%" border="0">
    <tr>
      <th scope="col">Patient Name<span class="style1">*</span></th>
      etc.
    </tr>
    <tr>
      <td><input name="patient" type="text" size="20" value="<?php echo $patient; ?>" /></td>

 

commit.php:

 

$query = "SELECT * FROM `icu` WHERE `patient` = '".$_POST['patient']."' ";
$result = mysql_fetch_array(mysql_query($query)) or die(mysql_error());


$problist = $result['problist'];
if($problist != $_POST[problist]) {
$problist_date = date("Y-m-d H:i:s");
}
else {
$problist_date = $result['problist_date'];
}

$todo = $result['todo'];
if($todo != $_POST[todo]) {
$todo_date = date("Y-m-d H:i:s");
}
else {
$todo_date = $result['todo_date'];
}

$sql = "UPDATE icu SET
rm_loc = '" . mysql_real_escape_string($_POST['rm_loc']) . "',
patient = '" . mysql_real_escape_string($_POST['patient']) . "',
mrn = '" . mysql_real_escape_string($_POST['mrn']) . "',
etc

 

Could the initial query in the beginning of commit.php be the problem since I used the _POST[patient] in the WHERE?  That's the only thing I can think of...

Link to comment
https://forums.phpfreaks.com/topic/138225-solved-edit-field-doesnt-update-weird/
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.