I have a problem with some of my first php scripts, hope you can help me out.
I have this really big form (around 200 text fields), so to make things faster and uses the less possible space I'm trying to insert the first text field to a database, then get its ID and start a cycle where the script will keep inserting on each one the information on each text field.
For some reason it's not working.
code:
<?php
error_reporting(E_ALL);
echo "Processing"...
mysql_connect("localhost","username","password") or die(mysql_error());
mysql_select_db("chismografo") or die(mysql_error());
$q = array(5);
for ($cpost=1; $cpost < 6; $cpost++)
{
$q[$cpost]=_POST["T".$cpost];
}
MYSQL_QUERY("INSERT INTO datos (id,q1) VALUES ('NULL', '$q[1]')");
$scriteria=(MYSQL_QUERY("SELECT id FROM `chismografo`.`datos` WHERE q1='$q[1]'"));
for ($postn=2; $postn < 6; $postn++)
{
MYSQL_QUERY("INSERT INTO datos (id,q[$postn]) VALUES ('$scriteria', '$q[$postn]')");
}
echo "Query Finished";
?>
Wohoo, 600th post...