RE: Validation problem with array.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux