Jump to content

[SOLVED] Very Quick Parse Error


herghost

Recommended Posts

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";
?> 

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?

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.