Ok. I know that my code goes into this function, added echos earlier to check
function registerUser($firstName, $surname, $email, $username, $password){
$md5pass = md5($password);
$_SESSION['regFirstname'] = $firstName;
$_SESSION['regSurname'] = $surname;
$_SESSION['regEmail'] = $email;
$_SESSION['regUsername'] = $username;
$_SESSION['regresult'] = addNewUser($firstName, $surname, $email, $username, $md5pass);
$_SESSION['registered'] = true;
}
addNewUser is called by one of the sessions, which is this
function addNewUser($firstName, $surname, $email, $username, $md5pass){
echo '<ul class="error">';
echo "<li>ENTER ADD NEW USER!</li>";
echo "<li>".$firstName."</li>";
echo "<li>".$surname."</li>";
echo "<li>".$email."</li>";
echo "<li>".$username."</li>";
echo "<li>".$md5pass."</li>";
echo "</ul>";
global $conn;
$q = "INSERT INTO users (firstName, surname, email, username, password) VALUES ('$firstName', '$surname', '$email', '$username', '$md5pass')";
return mysql_query($q,$conn);
}
All the echos echo out the correct values, so I know these are all holding values.
At the top of this page, I include my Database.php. This performs a standard connection
<?
include("constants.php");
$conn = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(DB_NAME, $conn) or die(mysql_error());
?>
constants.php holds my details. Connection returns no errors, and code goes into this file as I also tested this.
Reason the result of my qyery is assigned to a session is because I then use this session to decide what is displayed in this page. But even doing this, the session should not really effect the execution of the query.
One point to note is that the first column in my table is an ID with an auto increment. Didnt know if I needed to account for this in the query?
cheers