1

My code for Buy.php.

For some reason whenever I fill out both fields of shares and symbol correctly I get the apologize error that the data wasn't inserted into the table correctly. (I don't think I made any significant changes to the code recently to cause this because it was working just fine moments ago). What could be wrong, I would think for the issue to be around the if statement that inserts the new shares bought.

For some reason query() returns 2 (stored in $buyCheck) for the long INSERT statement, why? I have no clue. I believe it should only be updating/inserting one row in that SQL statement. Any help will be greatly appreciated.

1

Learn something new every day! From the manual:

With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if the row is inserted as a new row, 2 if an existing row is updated, and 0 if an existing row is set to its current values.

(Found the answer here.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .