Jump to content
Larry Ullman's Book Forums

Recommended Posts

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

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.

  • Upvote 1
Link to comment
Share on other sites

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
 Share

×
×
  • Create New...