Re: A problem with insert to mysql from a web interface

From: Date: Sun, 14 Jul 2002 04:05:49 +0000
Subject: Re: A problem with insert to mysql from a web interface
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-20537@lists.php.net to get a copy of this message
On Sunday 14 July 2002 03:43, Chip Wiegand wrote: > > > $sql = "INSERT INTO legs > > > (squats,squats_reps,legpress,legpress_reps,legext,legext_reps,legcurls, > > > legcurls_reps,calfraise,calfraise_reps,hipabducter,hipabducter_reps, > > > hipadducter,hipadducter_reps,comments) > > > VALUES('$squats','$squats_reps', > > > > > > '$legpress','$legpress_reps','$legext','$legext_reps','$legcurls', > > > > > > '$legcurls_reps','$calfraise','$calfraise_reps','$hipabducter', > > > > > > '$hipabducter_reps','$hipadducter','$hipadducter_reps','$comments')"; > > > > echo $sql; # ??? > > What does that do? And would I put it somewhere in my web page code? > I've not seen this before. That is _the_ most basic debugging procedure. Print out the values of variables at strategic points in the code to find out why something doesn't work as expected. In your case, as register_globals was disabled, all your variables -- $squats, $squats_reps etc -- would have been empty. Thus "echo $sql" would have immediately drawn your attention to this fact, and explain _why_ your query didn't insert anything and would've given you enough clue on _how_ to rectify the problem. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* If a man loses his reverence for any part of life, he will lose his reverence for all of life. -- Albert Schweitzer */

« previous php.db (#20537) next »