In the second example you are enclosing field values
with ticks ` instead of single quotes '
You don't get any errors because you don't check for errors,
if you put :
echo mysql_error();
after mysql_query (....) you will see the error.
To solve this problem simple replace ticks enclosing values
from the second example with single quotes :
mysql_query("INSERT INTO `orders` VALUES ('$ordernumber' ,
'$companyname' , '$billingaddress' , '$City' , '$State2' , '$Zip' ,
'$PhoneNumber' , '$FaxNumber' , '$WebPage' , '$EmailAddress' , '$Notes'
, '$Customer' , '$Startdate' , '$Completedate' , '$Biddate' ,
'$Bidamount' , '$ElecProjCost' , '$ElecProjBill' , '$ElecRem' ,
'$CtrlProjCost' , '$CtrlProjBill' , '$CtrlProjrem' , '$OthrProjCost' ,
'$OthrProjBill' , '$OthrProjrem', '$BondAm', '$BondBill' , '$BondRem' )");
----- Original Message -----
From: "Brian E Boothe" <[EMAIL PROTECTED]>
Newsgroups: mysql.general
To: <[email protected]>
Sent: Friday, April 14, 2006 5:59 AM
Subject: Wont insert into database
>i have two php Forms to insert data into a Mysql 4.0.20d Database, one
> is just a simple form to test if it works the other is the Actual
> application,
> here is the test form and works Perfectly
> >>
> <?
> $name=$_POST['Name'];
> $value1=$_POST['value1'];
> $value2=$_POST['value2'];
> $sum=$_POST['sumfield'];
> mysql_connect("localhost","root","") or die(mysql_error());
> mysql_select_db("testbase") or die(mysql_error());
> mysql_query("INSERT INTO `formadder` VALUES ('$name','$value1',
> '$value2','$sum')");
> Print "Your information has been successfully added to the database.";
> ?>
>
>
> NOW , / here is the Form data submitter that doesn't Work Ive
> checked and checked and check this damn Code with my form and nothing is
> outta place, ("i dont think")
> BUT will NOT Insert anything to the database even though i get no
> errors at all and it says "Your information has been successfully added
> to the database."; all the feilds are blank
>
> <?
> $ordernumber = $_POST['ordernumber'];
> $companyname = $_POST['companyname'];
> $billingaddress = $_POST['billingaddress'];
> $City = $_POST['City'];
> $State2 = $_POST['State'];
> $Zip = $_POST['Zip'];
> $PhoneNumber= $_POST['PhoneNumber'];
> $FaxNumber = $_POST['FaxNumber'];
> $WebPage= $_POST['WebPage'];
> $EmailAddress = $_POST['EmailAddress'];
> $Notes = $_POST['Notes'];
> $Customer= $_POST['Customer'];
> $Startdate = $_POST['Startdate'];
> $Completedate = $_POST['Completedate'];
> $Biddate= $_POST['Biddate'];
> $Bidamount = $_POST['Bidamount'];
> $ElecProjCost = $_POST['ElecProjCost'];
> $ElecProjBill = $_POST['ElecProjBill'];
> $ElecRem = $_POST['ElecRem'];
> $CtrlProjCost = $_POST['CtrlProjCost'];
> $CtrlProjBill = $_POST['CtrlProjBill'];
> $CtrlProjrem = $_POST['CtrlProjrem'];
> $OthrProjCost = $_POST['OthrProjCost'];
> $OthrProjBill = $_POST['OthrProjBill'];
> $OthrProjrem = $_POST['OthrProjrem'];
> $BondAm= $_POST['BondAm'];
> $BondBill= $_POST['BondBill'];
> $BondRem= $_POST['BondRem'];
> mysql_connect("localhost","root","") or die(mysql_error());
> mysql_select_db("workorder") or die(mysql_error());
> mysql_query("INSERT INTO `orders` VALUES (`$ordernumber` ,
> `$companyname` , `$billingaddress` , `$City` , `$State2` , `$Zip` ,
> `$PhoneNumber` , `$FaxNumber` , `$WebPage` , `$EmailAddress` , `$Notes`
> , `$Customer` , `$Startdate` , `$Completedate` , `$Biddate` ,
> `$Bidamount` , `$ElecProjCost` , `$ElecProjBill` , `$ElecRem` ,
> `$CtrlProjCost` , `$CtrlProjBill` , `$CtrlProjrem` , `$OthrProjCost` ,
> `$OthrProjBill` , `$OthrProjrem`, `$BondAm` , `$BondBill` ,
> `$BondRem` )");
>
> Print "Your information has been successfully added to the database.";
> ?>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]