Data not saved in database

ngb 20 Aug, 2010
Hi,

I have problems to save my form data into a database.

I wrote following in the section "On submit code - before sending email"


<?php
$query_add = "" ;
$query_add .= "insert into ngb_leden " ;
$query_add .= "(naam,voornaam,straat,nummer,bus,telefoon,gsm,mail,geb_datum,geb_plaats,nationaliteit,geslacht,med_opm,gemeente values('" . $Naam . "','" . $Voornaam . "','" . $Straat . "','" . $Nummer . "','" . $Bus . "','" . $Telefoonnummer . "','" . $GSMnummer . "','" . $Email . "','" . $Geboortedatum . "','" . $Geboorteplaats . "','" . $Nationaliteit . "','" . $Geslacht . "','" . $MedOpmerking . "','" . $Gemeente . "')";

echo "query add: " . $query_add;

$db->setQuery($query_add);
$db->query();
		
$query_add = "";
$query_add .= "insert into ngb_leden_detail ";
$query_add .= "(code, leden_id) values ('" . $Categorie . "',". mysql_insert_id() . ")";

$db->setQuery($query_add);
$db->query();
		
?>


The
echo "query add: " . $query_add;
gives no output.

Thanks to help me!

Pieter
GreyHead 21 Aug, 2010
Hi ngb,

I think that the immediate problem is that you haven't defined $db
$db =& JFactory::getDBO();
but ChronoForms can probably do all this for you. Please check the Database Tutorial from the Tutorials link above.

Bob
This topic is locked and no more replies can be posted.