Jump to content

Cannot get insert into working!


samf_20

Recommended Posts

Hi,

 

I have created a online ordering form which works perfectly. But when I wrote my mysql statement to get it to be inserted into my database nothing displays in the database.

 

Here is the code I got:

 

mysql_select_db("mcerts", $con);

$insertQuery = "Insert into conferencereg(fullname, companyname, positiontitle, streetaddress, city, countystate, zipcode, countryname, telephone, fax, email, isregisterforfive, isattendinggaladinner";

$insertValues = "values('$_POST[fullname]','$_POST[company]','$_POST[positiontitle]','$_POST[street]','$_POST[city]','$_POST[county]','$_POST[postcode]','$_POST[country]','$_POST[telephone]','$_POST[fax]','$_POST[email]',";

if(isset($_POST["registrationday"]))
{
//	if (strcmp ($_POST["registrationday"],"55.001")>0){
if ($_POST["registrationday"]=="55.001"){
	$insertValues = $insertValues."1";
}
else if ($_POST["registrationday"]=="55.002"){
	$insertValues = $insertValues."2";
}
else if ($_POST["registrationday"]=='100.00'){
	$insertValues = $insertValues."3";
}
}
if(isset($_POST["fifthDecCheckBox"]))
{
$insertValues = $insertValues.",1";
}
else
{
$insertValues = $insertValues.",0";
}

if(isset($_POST["card"]))
{
	$insertQuery = $insertQuery.", iscardpaymentmode, cardtype, cardnumber, cvv2number, cardholdername, cardexpirydate, dinnerstreet, dinnercity, dinnercountystate, dinnerpostalcode, dinnercountry";
	$insertValues = $insertValues. ",1,'$_POST[cardtype]','$_POST[cardnumber]','$_POST[cvv2number]','$_POST[cardholdername]','$_POST[cardexpirydate]','$_POST[cardstreet]','$_POST[cardcity]','$_POST[cardcounty]','$_POST[cardpostcode]','$_POST[cardcountry]'";
}
else if(isset($_POST["invoice"]))
{
	$insertQuery = $insertQuery.", isinvoicepaymentmode, dinnerstreet, dinnercity, dinnercountystate, dinnerpostalcode, dinnercountry";
	$insertValues = $insertValues. ",1,'$_POST[invoicestreet]','$_POST[invoicecity]','$_POST[invoicecounty]','$_POST[invoicepostcode]','$_POST[invoicecountry]'";
}
else if(isset($_POST["cheque"]))
{
	$insertQuery = $insertQuery.", ischequepaymentmode";
	$insertValues = $insertValues. ",1";
}

else
{
$insertValues = $insertValues.",0";
}


//echo $insertQuery.") ".$insertValues.")";
$strQuery=$insertQuery.") ".$insertValues.")";
//echo ($strQuery);
mysql_query($strQuery);

//

?>

 

Any help will be appreciated!

 

Thanks,

Sam

Link to comment
Share on other sites

Insert into conferencereg(fullname, companyname, positiontitle, streetaddress, city, countystate, zipcode, countryname, telephone, fax, email, isregisterforfive, isattendinggaladinner, isinvoicepaymentmode, dinnerstreet, dinnercity, dinnercountystate, dinnerpostalcode, dinnercountry) values('sam','sam','sam','sam','sam','sam','sam','UNITED KINGDOM','21123','213213','email address',1,0,1,'sam','sam','sam','sam','UNITED KINGDOM')

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.