redarrow Posted March 6, 2009 Share Posted March 6, 2009 change the name of the insert_querys insert1 insert2 then see what happens. dont use the same insert name as each over. Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 6, 2009 Share Posted March 6, 2009 example should work now. <?php session_start(); $_SESSION['house'] = $_POST['house']; $_SESSION['fline'] = $_POST['fline']; $_SESSION['sline'] = $_POST['sline']; $_SESSION['city'] = $_POST['city']; $_SESSION['county'] = $_POST['county']; $_SESSION['postcode'] = $_POST['postcode']; include('include/config.php'); $query = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$query) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } $insert_query1 = "insert into members ( firstname, lastname, login, passwd, email ) values ( " . $_SESSION['firstname'] . ", " . $_SESSION['lastname'] . ", " . $_SESSION['login'] . ", " . $_SESSION['passwd'] . ", " . $_SESSION['email'] . " )"; mysql_query($insert_query1)or die(mysql_error()); $insert_query2 = "insert into members_location ( house, fline, sline, city, county, postcode ) values ( " . $_SESSION['house'] . ", " . $_SESSION['fline'] . ", " . $_SESSION['sline'] . ", " . $_SESSION['city'] . ", " . $_SESSION['county'] . ", " . $_SESSION['postcode'] . " )"; //let's run the query mysql_query($insert_query2)or die(mysql_error()); echo " $insert_query1 <br> $insert_query2"; ?> Quote Link to comment Share on other sites More sharing options...
hagiwhat Posted March 6, 2009 Share Posted March 6, 2009 do the rest then test Quote Link to comment Share on other sites More sharing options...
herghost Posted March 6, 2009 Author Share Posted March 6, 2009 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@getstock.co.uk )' at line 13 Bugger it! Thanks, so nearly there....! Quote Link to comment Share on other sites More sharing options...
herghost Posted March 7, 2009 Author Share Posted March 7, 2009 Just an idea? The 1st table of both of my databases are a member_id tablem which is auto increment. However I have noticed that my registration pages do not include this on the forms etc, is this what could be causing it not to work? As the script is trying to post in the wrong table and so the mail field is trying to save data as a md5 password? Quote Link to comment Share on other sites More sharing options...
herghost Posted March 8, 2009 Author Share Posted March 8, 2009 Think I have it solved! Forgot about sessions and come up with this: do page: <?php session_start(); ?> <?php include('include/config.php'); $query = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$query) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die('Unable to select database: ' . mysql_error()); } $_SESSION['firstname'] = $_POST['firstname']; $_SESSION['lastname'] = $_POST['lastname']; $_SESSION['login'] = $_POST['login']; $_SESSION['passwd'] = md5($_POST['passwd']); $_SESSION['email'] = $_POST['email']; $query = "INSERT INTO `cvsite`.`members`(`member_id`, `firstname`, `lastname`, `login`, `passwd`, `email`) VALUES(NULL, '$firstname', '$lastname', '$login','".md5($_POST['passwd'])."', '$email')"; mysql_query($query); echo "$query"; echo mysql_error(); ?> Not sure how not storing them as sessions are going to effect me later, but we shall see! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.