Click to See Complete Forum and Search --> : Inserting into MySQL database


Sux0rZh@jc0rz
12-11-2003, 06:36 PM
I have an MySQL database at www.freesql.org and a website at http://xaxei.2ya.com and i cant get this registration script to work... (to be used with a login script..) anyways, can you please tell me why the script below doesnt work? when i try to register it takes me to a blank page.. and so i assume it works but when i check the database, it hasn't uploaded the new user! evilness. anyways.. thanks MUCH in advance.. it must be something so obvious i cant see it. bein a PHP noob and all.

Register.php<?php


$username="$_POST['username'];
$password="$_POST['password];
$email="$_POST['email'];
$host="http://www.freesql.org:3306";
$dbusername="xaxei";
$dbpassword="***";
$database="xaxei";
$signup="INSERT INTO `Users` (`id`, `created`, `username`, `userpass`, `email`) VALUES ('', NOW(), '$username', '$password', '$email')";

mysql_connect($host,$dbusername,$dbpassword);

@mysql_select_db($database) or die("Unable to select database");
mysql_query($signup) or die("Unable to register character");

mysql_close();

?>Register.html (http://www.webspace4free.biz/xaxei/register.html)<h1 class="Main">Register:</h1>
<form method="post" action="register.php">
<p class="MainText" style="text-align:center;">Username: <input type="text" name="username" size="11" /><br /> &nbsp;Password: <input type="password" name="password" size="11" /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Email: <input type="text" name="email" size="11" /><br /></p>
<p class="MainText" style="text-align:center;"><input class="Submit" type="submit" value=" Submit" /></p>
</form>

Khalid Ali
12-11-2003, 08:00 PM
use the following string,and make sure that all the column names exist and the values have values that you are trying to enter

$signup="INSERT INTO Users (id, created, username, userpass, email) VALUES ('', NOW(), '$username', '$password', '$email')";