RE: [PHP] Validation problem with array.

From: Date: Thu, 21 Oct 2004 10:34:32 +0000
Subject: RE: [PHP] Validation problem with array.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-199965@lists.php.net to get a copy of this message
See inline: [snip] > > Now the transcation script: > > $skills = $_SESSION['skills']; > $skys = $_SESSION['skys']; > $slus = $_SESSION['slus']; > > foreach($_SESSION['skills'] as $key => $skill) ^^^^^^^^^^^^^^^^^^^ ($skills as $key => $skill) > { if ($skill != '') // Has this skill been entered? { // You may also want to check for sky & slu entries > $query = "INSERT INTO LurkProfiles_Skicerts > (SkicertID, ProfileID, SkilCerts, NumYear, Lused) > VALUES (null, $LID, '$skill', > {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]})"; ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ $skys[$key] $slus[$key] > //$result = mysql_query($query); > $res6 = run_query($query); > echo $query; ^^^^^^^^^^^ What does this output? }// end if ($skill != '') > } > > I understand that in the insert statement I need not > repeat $_SESSION. > The rest though is fuzzy. > It was working, now I'm getting some really odd > behaviour, in that, unless i fill in every field in > the form, I get a mysql syntax error. HTH Graham

« previous php.general (#199965) next »