02-14-2008, 12:42 AM
|
#12 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Posts: 87
Thanks: 49
|
I don't know what was wrong there, but I seemed to have fixed it!
I didn't know that addslashes and mysql_real_escape_string() weren't to be used together. Thanks for letting me know!
I am getting somewhere now, I have the following:
Code:
<?php
//Database Structure
//Setting username and password
$username="";
$password="";
$database="scotlandbands";
mysql_connect($localhost, $username, $password) or die ('<strong>MySQL Error:</strong>'.mysql_error());
mysql_select_db($database) or die ('<strong>MySQL Error:</strong>'.mysql_error());
//setting variables
$reg_username = ($_POST['reg_username']);
$reg_email = ($_POST['reg_email']);
$reg_password = md5($_POST['reg_password']);
//creating a query that inserts the data into the database
$query = 'INSERT INTO users SET user_name = "'.mysql_real_escape_string($reg_username).'",
email = "'.mysql_real_escape_string($reg_email).'",
user_pass = "'.mysql_real_escape_string($reg_password).'"';
//execcute a query on a MySQL database
mysql_query($query);
//close database connection
mysql_close();
?>
Hope that's more readable now!
Now, when I try to enter a username and password which is stored in the database, I'm being taken to login.html - which means the login was not successful. I don't know why this is happening, because I'm entering the correct details.
|
|
|
|