Re: $_POST arrays not evaluated in sql statement -- why?

From: Date: Wed, 26 Feb 2003 05:14:18 +0000
Subject: Re: $_POST arrays not evaluated in sql statement -- why?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-137183@lists.php.net to get a copy of this message
Hey John et. al............ I tried your method John, and it works! Re: excessive single quotes in the sql, but I tried stripping them out to no effect. Using curly braces in the sql statement wasn't an option I knew about. Thanks again for illuminating another bit of the PHP world......... --Noah "John W. Holmes" <holmes072000@charter.net> wrote in message news:001f01c2dd34$26719110$7c02a8c0@coconut... > > > > ('1','1','$date','$_POST['jersey_id'][$x]','$_POST['first'][$x]','$_POST > [' > > Let's just be smart and think about this for a second. Look at all of > the single quotes you've got. How do you expect PHP to be able to tell > what's a variable and what's text? Do you mean $_POST or > $_POST['jersey_id'] or $_POST['jersey_id'][$x] as the variable? PHP > can't read your mind. > > Anyway, if you're going to use this method, put braces around your > variable, so PHP knows what you are sending it. > > > ('1','1','$date','{$_POST['jersey_id'][$x]}','{$_POST['first'][$x]}' > > or this method > > > ('1','1','$date','$_POST[jersey_id][$x]','$_POST[first][$x]' > > PHP will be greedy, I think, and assume you mean $_POST[jersey_id][$x] > as the variable. > > Or this method > > > ('1','1','$date','".$_POST['jersey_id'][$x]."','".$_POST['first'][$x]."' > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > >

« previous php.general (#137183) next »