$query= "insert into First Name:('"First Name`=`First Name`and `Last Name:`=`Last Name:`
and `Address`=`Address` and `State`=State` and `City`=`City` and `Tel`=`Tel` and
`Email`=`Email` and `Comments`=`Comments` and `Position:`=`Position:`
and `Status`=`Status`");"
,$db) or die(mysql_error());
$result=mysql_query($query);
if($result)
echo mysql_affected_rows()." Business Owner Inserted.';
?>
any other way i should be doing it this
thank you .
chazzy
06-07-2006, 11:55 AM
INSERTS look like this:
INSERT INTO table(col1,col2,...,coln) VALUES('val1','val2',...,'valn');
franknu
06-07-2006, 07:23 PM
I did some changes and i was still getting a parser error
echo mysql_affected_rows()." Business Owner Inserted.';
?>
the error messages is showing outsite the tags
Parse error: parse error in /home/httpd/vhosts/mass-ad.com/httpdocs/insert_data.php on line 64
i dont have line 64
thank you
chazzy
06-07-2006, 07:51 PM
don't use single quotes to encapsulate your string in php when using sql, it's difficult to read (so remove the \'s). also you don't need the ; when going through php.
why do you connect to your database twice?
it looks like you might have some spacing issues. try to cut down and use {} whenever possible.
franknu
06-07-2006, 08:11 PM
ok, i fixed i only have one little problem when i send the data via a form, there is no info saved on the databse there is only empty rows, can anyone please tell me why is that here are the codes
if($result)
{
echo mysql_affected_rows()." Business Owner Inserted.";
}
?>
this is the error
Parse error: parse error in /home/httpd/vhosts/mass-ad.com/httpdocs/insert_data.php on line 48
chazzy
06-08-2006, 05:29 PM
$sql = "INSERT INTO `First Name:` ( `First ` , `Last ` , `Address` , `State` , `City` , `Zip` , `Tel` , `Email` , `Comments` , `Position:` , `Status` ) VALUES ('".$First."','".$Last."','".$Address/* and so on, you should get the picture.*/)";
Please note the order in which I use the `,",', and .
franknu
06-08-2006, 07:47 PM
well, i cant see what the problems is maybe i am missing something i am still getting a parser error or no data is intruduce into the database can anyone please pinpoint the problem
$sql="INSERT INTO `First Name:` (`First`,`Last`,`Address`,`State`,`City`, `Zip`,`Tel`, `Email`,`Comments`,`Position`,`Status`)
VALUES ('".$First."','".$Last."','".$Address."','".$State."','".$City."','".$Zip."','".$Tel."','".$Email."','".$Comments."','".$Position."','".$Status.");
$result=mysql_query($sql);
if($result)
{
echo mysql_affected_rows()." Business Owner Inserted.";
}
?>
this is the error
Parse error: parse error in /home/httpd/vhosts/mass-ad.com/httpdocs/insert_data.php on line 56
thank you for your help
chazzy
06-08-2006, 08:04 PM
in that last post, the error's right here:
."','".$Status.");
should be
."','".$Status."'");
hyperlisk
06-08-2006, 08:34 PM
You know, I don't see anywhere that you are collecting the data from the $_POST or $HTTP_POST_VARS variable... You need to get the data before you can insert it...
this is the error message that i am getting now i have the row First int he colum First name:
help
hyperlisk
06-08-2006, 10:18 PM
OK, NONE of your tables or rows should have spaces in the names. If they do, then you need to fix them. Just use an underscore (_) instead, then update your code.
franknu
06-09-2006, 07:37 AM
Everything works Great thank you, it seems my problem were mostly at the database
thank you
webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved.