Click to See Complete Forum and Search --> : record not adding


USER4FUN
02-13-2006, 12:58 AM
I am really stuck in this one, Ii just can't get it working.

when i check my table after running this code, the record never gets added.

If you happen to spot the problem ( i am sure most of you will) please drop me a quick post and guide me)

// the table in which i am adding this record is called (BusFile) it is under a database called (Business)
<html>
<head>
<title>Business PHP add</title>
</head>
<body bgcolor="white">
<?php
foreach($HTTP_POST_VARS as $varname => $value)
$formVars[$varname]=$value;
$db1=mysql_connect($dbhost, $dbuname, $dbpass);
mysql_select_db("BusFile");
echo "Record Added<br><a href=\"BusinessAdd.htm\">click here</a>
to return to Business Information Control<br>";
$query="INSERT INTO BusFile set ".
"Status= \"".$formVars["Status"]."\",".
"Fname= \"".$formVars["Fname"]."\",".
"Lname= \"".$formVars["Lname"]."\",".
"Email= \"".$formVars["Email"]."\",".
mysql_query($query);
mysql_close($db1);
?>
</body>
</html>

SpectreReturns
02-13-2006, 01:00 AM
Have you done any error checking to make sure the query worked?

USER4FUN
02-13-2006, 01:33 AM
i am using phpmyadmin sir, i am not certain about the query check but when i open the table to see teh records, it still says zero records?

thank you very much for reading my post and trying to help me.

sridhar_423
02-13-2006, 01:43 AM
what is this "set" doing in an INSERT Statement? I think it has to be "values".
I dont have any idea of this "mysql" but am aware of simple PL/SQL. might be, this works out in mysql too...

USER4FUN
02-13-2006, 02:15 AM
I have tried it every way i know how ( not many, but acouple lol)

I am givng up, i hope a more experienced gemtlemen can help me.

chazzy
02-13-2006, 10:32 AM
your insert statement is not standard (and doesn't follow the other form)

use
INSERT into table(column_list..) VALUES(value_list...);