This has been bugging me for ages now. Finally got over a few problems.
INSERT INTO doesn't seem to work. I check my DB and no new data is added. Any ideas?
the:
if (!$insert){
echo "insert into not working";
exit;
}
shows true. I have double checked the names of the database and tables. Also all the form values are correct.
Is it syntax?
Code: Select all
<?php
$link = mysql_connect('localhost', 'root', 'root');
$db = mysql_select_db('jobs4alltrades', $link);
$insert = mysql_query("INSERT INTO members (loginid, password, firstname, surname, email,
trade, address1, address2, address3, address4,
postzip, country, yearsexp, about)
VALUES ('".$_POST['loginid']."', '".$_POST['password']."', '".$_POST['firstname']."',
'".$_POST['surname']."', '".$_POST['email']."', '".$_POST['trade']."', '".$_POST['address1']."',
'".$_POST['address2']."', '".$_POST['address3']."','".$_POST['address4']."', '".$_POST['post']."',
'".$_POST['country']."','".$_POST['yearsexp']."','".$_POST['about']."')");
if (!$insert){
echo "insert into not working";
exit;
}
$result = mysql_query($insert, $link);
if(!$link){
echo "Sorry, we are having a few problems with our system. Please try again later. link";
exit;
}
else{
echo "Your details have been stored in our database. Use the the navigation bar at the top to look for jobs.";
}
?>