jeudi 2 juillet 2015

distilled example of PHP "IF" statement referring to MYSQL record

MY OBJECTIVE: use correct syntax/spelling in PHP "if" statement for MYSQL database records.

MY SITUATION: beginner learning php for mysql database. can successfully connect to and create/alter/update tables. can successfully achieve if/else results WHEN the variables do NOT refer to records in a db.

MY PROBLEM: multiple failures at using "if" statements in PHP when the "if" depends on the value of a record in a mysql db.

EXAMPLE OF WHAT I WANT, IN PLAIN ENGLISH: database name "MAIN", table name "COMP", column name "WINS". I can already write php that selects specific record data. The point is that I now want to write a simple PHP script that (in plain english, as an example) says: if WINS=5 then echo "GOOD JOB", otherwise echo "whatever." (the problem isn't the echo part: the problem I have is correctly writing the IF part REFERRING to a specific value in a record.

I've spent all day searching, and I can find tons of examples of PHP if statements that DO NOT refer to a db record, and a ton of PHP statements that DO refer to mysql tables but, alas, they are part of far more complex operations with too many factors that a beginner like myself can't sort through. I cannot find the most simplified example of that part of the PHP script that would feature the IF statement WITH REFERENCE to a value in a specific database/table/column. any help would be appreciated. thank you.

Aucun commentaire:

Enregistrer un commentaire