I have error on this line..
what should I change..thank you

mysql_query("INSERT INTO lesson (subject,year,learningArea,objectives,ability) VALUES 
                  ('<?php echo $onrow["subject"]', '<?php echo $onrow["year"]', '<?php echo $onrow["learningArea"]', '<?php echo $onrow["objectives"]', '<?php echo $onrow["ability"]' ") or die(mysql_error());

you're already in PHP, you don't need to do <?php echo Also, you're in double quotes so you must surround the $onrow["index"] with {} ie., {$onrow["index"]}

commented: thanks for your explanation :).it helps me understanding php better +1

Try something like this

mysql_query('INSERT INTO lesson (subject, year, learningArea, objectives, ability) VALUES ("'.mysql_real_escape_string($onrow["subject"]).'", "'.mysql_real_escape_string($onrow["year"]).'", "'.mysql_real_escape_string($onrow["learningArea"]).'", "'.mysql_real_escape_string($onrow["objectives"]).'", "'.mysql_real_escape_string($onrow["ability"]).'"') or die(mysql_error());

You may also want to post what was on the line before this as it too may also have an effect.

commented: Thanks for your explanation +1

thanks cwarn23 and shawncplus..
I have tried before..
there is no error now..but the new record is not saved .
What I intend to do is to save a new record after customization.
I do not use update since this is a set of new record..(customised from the displayed record..

thank you for your help.

thanks..
i have solved this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.