View Single Post
Old 01-05-2013, 10:56 PM   PM User | #1
amcf1992
Regular Coder

 
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
amcf1992 is an unknown quantity at this point
PHP or die mysql error

Thanks in advanced for the help, anyways i'm coding a register script
but im not seeing the mysql_error message, the page when executed doesn't show the actual mysql error ( like it should), it just says mysql_error()


database/config.php

PHP Code:
<?php
$mysql_hostname 
"localhost";
$mysql_user "root";
$mysql_password "";
$mysql_database "test";
$db mysql_connect($mysql_hostname$mysql_user$mysql_password)
or die(
"mysql_error()");
mysql_select_db($mysql_database$db) or die("mysql_error()");
?>
Registration.php
PHP Code:
<?php
include("database/config.php");
if(
$_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from Form
$username=mysql_real_escape_string($_POST['username']);
$password=mysql_real_escape_string($_POST['password']);
$password=md5($password); // Encrypted Password
$email=mysql_real_escape_string($_POST['email']);
$date date();



$sql="Insert into test (id, username, password, email, date ) values('','$username','$password','$email','$date');";
$result=mysql_query($sql);
echo 
"You have successfully registered, you may login now. ";
}
?>
<form action="registration.php" method="post">


Email: <input type="text" name="email"/>

Username: <input type="text" name="username"/>
<br />
Password: <input type="password" name="password"/>
<br/>
<input type="submit" value=" Submit "/>
<br />
</form>
amcf1992 is offline   Reply With Quote