RE: probably stupid, but...

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

 



Robert Sossomon <mailto:robert_sossomon@xxxxxxxx>
    on Friday, November 12, 2004 12:09 PM said:

> I have a form that sends 20 rows of data into a script, instead of
> having to write 20 separate add functions, I wrote this piece of
> code...

you've actually got quite a few mistakes.

>   if ($_POST[book_title_$i]' != "")

notice ----------------------^

there is an extra '. the line should really look like:

if (!empty($_POST['book_title_'.$i])
{
  ...

>   {
>    INSERT INTO `curriculum` VALUES
>
('','$_POST[book_title_$i]','$_POST[book_level_$i]','$_POST[level_grades
_$i]','$_POST[book_section_$i]','$_POST[chapter_$i]','$_POST[chapter_tit
le_$i]','$_POST[lesson_title_$i]','$_POST[skill_$i]','$_POST[life_skill_
$i]','$_POST[success_indicator_$i]','$_POST[ncscos_$i]','$_POST[subject_
$i]','$_POST[pages_$i]','$_POST[c_kit_$i]');

and then here you don't even assign that sql statement to anything. PHP
doesn't know what to do with it.

also you need to wrap your array values in { } when an array is
referenced within a string. i.e.

// normal
$value = $_GET['something'];

// with { }
$value = "Here is some data: {$_GET['something']}";


hth,
chris.

-- 
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