scooterlibby Posted March 28, 2007 Share Posted March 28, 2007 This is a follow on from a previous post, I managed to get data to my script however the UPDATE command will not update the record on the file Can anyone help me with the update command fields on file = date1 group1sts and group2sts these are coming from a select and modify script. Thanks in advance <?php include 'config.php'; include 'opendb.php'; // update record after xxx xxy now xxz // $sql = "UPDATE petaluma SET date1 = '$fa', group1sts = "$fx", group2sts = "$fy" WHERE date1 = "$fa""; // does nt like $sql = "UPDATE petaluma SET date1 = \'$fa\', group1sts = \'$fx\', group2sts = \'$fy\' WHERE date1 = $fa " ; // blank screen $sql = "UPDATE petaluma SET date1 = '$fa', group1sts = '$fx', group2sts = '$fy' WHERE date1 = $fa " ; // blank screen //$sql = "UPDATE petaluma SET group1sts = '$_post[group1sts]', group2sts = $_POST[group2sts]', WHERE date1 = '$_POST[date1]' "; //$sql = "UPDATE petaluma SET date1='$fa', group1sts='$fx', group2sts='$fy' WHERE date1='$fa' " //$query="update petaluma SET group1sts=\"$_GET[ud_date]\", venue=\"$_GET[ud_venue]\", info=\"$_GET[ud_info]\" WHERE id=\"$_GET[ud_id]\""; //$sql_result = mysql_query($sql, $conn) or die ("zero-connection to the Petaluma file"); $sql = "UPDATE petaluma SET group1sts='$qfx', group2sts='$qfy' WHERE date1='$qfa' "; $sql_result = mysql_query($sql, $conn) or die(mysql_error()); // Update record $qfa = $_POST['date1']; // these fields will be updated $qfx = $_POST["group1sts"]; $qfy = $_POST["group2sts"]; // other date fields for display only $qfb = $_POST['date2']; $qfc = $_POST['date3']; If (!$sql_result) { echo "<p> record not updated</p> "; } else { // format results by row echo " <html> <body><center> <table width=602><tr><td><fieldset> <font face=arial><center> <h3>Petaluma Schedule Modified</h3> <br>Use this screen to check previous modification performed<br><br> <table width=600> <tr><td colspan=3> <center> <b>Class Dates</b> <br><br></td></tr> <tr> <td align=center colspan=3> <fieldset><br><br> Date1 ".($_POST[date1])." <br><br> Date2 ".($_POST[date2])." <br> Date3 ".($_POST[date3])." <br><br> Group 1 message ".($_POST[group1sts])."<br> Group 2 message ".($_POST[group2sts])."<br> <br><br> </fieldset> </td> </tr> </table> <br><br> <font size=1> </fieldset> </td></tr></table> </body> </html> "; } // free resources mysql_free_result($sql_result); mysql_close($dbh); ?> Link to comment https://forums.phpfreaks.com/topic/44571-solved-problem-with-the-update-command/ Share on other sites More sharing options...
AndyB Posted March 28, 2007 Share Posted March 28, 2007 move the query string definition and the query execution to after you abstract the results from the POSTed values Link to comment https://forums.phpfreaks.com/topic/44571-solved-problem-with-the-update-command/#findComment-216481 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.