We help IT Professionals succeed at work.
Get Started

How do you test to see if your MySQL query is correct in PHP?

brihol44 asked
Last Modified: 2013-12-12
I'm a Coldfusion programmer but learning PHP. In Coldfusion if you have a UPDATE query written out similar like so...

UPDATE training_courses
                                 course_title = '$course_title',
                                 courseCategory = '$coursecategory',
                                 trainingType = '$trainingType',
                                 courseCategory = '$courseCategory',
                                 level = '$level',
                                 course_description = '$course_description',
                                 course_will_learn = '$course_will_learn',
                                 course_will_understand = '$course_will_understand',
                                 course_will_gain = '$course_will_gain',
                                 course_will_improve = '$course_will_improve',
                                 course_will_other = '$course_will_other',
                                 credits = '$credits',
                                 numOfSpeakers = '$numOfSpeakers',
                                 speakerID1 = '$speakerID1',
                                 speakerID2 = '$speakerID2',
                                 workShopLength = '$workShopLength',
                                 lecturePercentage = '$lecturePercentage',
                                 demonstrationPercentage = '$demonstrationPercentage',
                                 handsOnPercentage = '$handsOnPercentage',
                                 QandAPercentage = '$QandAPercentage',
                                 workShopComments = '$workShopComments'
                              WHERE record_id = $course_id";

and you misspelled a table cell variable Coldfusion would let you know that on line such and such db.tablecell does not exist.  In PHP it just does nothing. Is that just a limitation of PHP or is there something I turn on to debug my code or do I just need to go line by line to make sure that all of my SQL cell parameters as well as my code are is correct when nothing happens?  When you write SQL statements on the fly sometimes things get miss-spelled so I just thought I would ask.
Watch Question
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE