dickm Posted May 26, 2011 Share Posted May 26, 2011 This is driving me crazy. The echo statements for testing are returning the correct where condition variables but the columns are not updated in the table $query = ("UPDATE forms SET form_date = NOW(), form_amount = $camt, form_dispamt = $damt WHERE form_cusid = '$cusid' AND form_recid = '$rec_id' AND TRIM(form_type) LIKE '$afrmtype'"); $result = mysql_query ($query); // Run the query. echo ' Form ID: '. ' [<b>' .$frmid. ' </b> ]'; // this is the correct record id which is an auto-increment value echo ' Number of Rows: '. ' [<b>' .$num_rows. ' </b> ]'; // this is returning a count of 1 record Any help would be greatly appreciated. I have tried it with '$camt' for the SET variables and have tried the ".$camt." also and nothing has changed. The all give the same echo results but not update of data. Mahalo Link to comment Share on other sites More sharing options...
Antonio Conte Posted May 26, 2011 Share Posted May 26, 2011 How do you bind the value to $camt? Something like $_POST['camt'] = $camt; ? 1 Link to comment Share on other sites More sharing options...
Paul Swanson Posted May 26, 2011 Share Posted May 26, 2011 For debugging, try printing out your query variable and any MySQL errors that may be happening: echo "<p>Query: $query</p><p>MySQL Error: " . mysql_error() . "</p>"; Place that under your other echo statements and see if your query has the variables you expect, and whether MySQL is producing errors. You won't see database errors unless you use PHP's functions to display them. 1 Link to comment Share on other sites More sharing options...
dickm Posted May 26, 2011 Author Share Posted May 26, 2011 How do you bind the value to $camt? Something like $_POST['camt'] = $camt; ? They come from session variables. $camt = $_SESSION['camt']; Link to comment Share on other sites More sharing options...
dickm Posted May 27, 2011 Author Share Posted May 27, 2011 For debugging, try printing out your query variable and any MySQL errors that may be happening: echo "<p>Query: $query</p><p>MySQL Error: " . mysql_error() . "</p>"; Place that under your other echo statements and see if your query has the variables you expect, and whether MySQL is producing errors. You won't see database errors unless you use PHP's functions to display them. Thanks Paul; Printing out the results helped me track down my problems which were multiple. Two of the variables were not updating correctly from the previous POST and two were just my stupid misspelling. Now have the process working correctly. Mahalo Link to comment Share on other sites More sharing options...
Recommended Posts