Code: Select all
$counter = 1;
while ($counter < $calc && $firstname$counter != NULL)
{
mysql_query("INSERT INTO diary (userid, entrydate, entrytime, paymenttype, firstname, lastname) VALUES ('0', '$diarydate', '$bookslot', 'ByPhone', '$firstname', '$lastname')");
$counter = $counter + 1;
}So I am passing through the amount of rows available, but want it to only run an INSERT if say 4 have entries in them.
So I am trying to say "do this while counter is below the calcualted figure, and a particular row "firstname1", then "firstname2" have something in them. Trying it with "... && $firstname$counter != NULL, but this fails.
Is there a way to do this??