can anybody point out what ive done wrong in this code chunk and help me make corrections ? thanks.
trying to instert data into 4 diffrent fields in a table in a mysql db.
the code i have is this:
?>
$f1 = "field 1 data"
$f2 = "field 2 data"
$f3 = "field 3 data"
$f4 = "field 4 data"
$db = "db"
$table = "table";
$connect = "mysql_connect($host, $user, $pass)";
$select = "mysql_select($db, $connect)";
if ($select) {
mysql_query(insert into $table values($f1, $f2, $f3, $f4);
echo "OK!!";
}
else {
echo "Error!";
}
?>
when i execute it, it gives me a parse error on the mysql_query line. i cant figure out why. also, is this the right way to insert stuff into the db ? thanks for your help.