1

I have a caching script that requests a bunch of data from a SOAP API using PHP (Cron job every 5 minutes). This script requests and stores a customer id and name.

The table that the API information is stored in has 3 columns:

'id' = int, Primary_key
'name' = varchar(255)
'paying' = bool

There is around 10 (in 80) customers with the bool paying set to true. However, every once in a while the all customer's paying columns revert to 0.

So... Can the following query cause the paying column to change under any circumstances?

INSERT INTO customer(`id`, `name`) VALUES ('$escapedId','$escapedName') ON DUPLICATE KEY UPDATE `name`='$escapedName'
2
  • Do you have a unique index on the customer table in your database? or any other index? Commented May 9, 2016 at 7:57
  • @kejsu The id column is the primary key, the columns id and name are provided by the API. Commented May 9, 2016 at 7:59

1 Answer 1

1

This query couldn't change the 'paying' field state.

Therefore, most likely the reason is some other code that is either setting the value to 0, or just deleting all records.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.