Jump to content

Ugh. Registration Error.


ataria

Recommended Posts

Whenever I do register ... I go to check the database to see if it entered the username...
and, it never does.
Here is the code :

[code]$sql1 = "INSERT INTO `users` ( `UID` , `username` , `password` , `points` , `IP` , `email` , `fname` , `lname` , `gender` , `age` , `location` , `registered` , `last_login` , `admin` , `orientation` , `ethnic` , `music` , `AIM` , `YIM` , `MSN` ,  )
VALUES (

'', '${username}', '{$pw}', '5000', '{$REMOTE_ADDR}', '{$email}', '{$fname}', '{$lname}', '{$gender}', '{$age}', '{$location}', '{$day}', '{$day}', '0', '{$orientation}', '{$ethnic}', '{$music}', '{$AIM}', '{$YIM}', '{$MSN}' );";


mysql_query("$sql1");

$sql1;
print "<center><font class=user>$username</font><br> You have sucessfully registered! ";
[/code]


anyone know what the problem is !?


Extra Info ; This is only a little piece of the code (the mysql part).
Yes, I am connected to the database.
Yes, the php tags are closed.

[code]<?php
include ("global.php");
ob_start();
extract($_POST);
extract($_GET);
extract($_SERVER);

if ($action == register) {

if (!$username || !$pw || !$email || !$verpw || !$veremail || !$fname || !$lname) {


print " <center> One or more fields are empty. ";
exit;
}
$sql1 = "INSERT INTO `users` ( `UID` , `username` , `password` , `points` , `IP` , `email` , `fname` , `lname` , `gender` , `age` , `location` , `registered` , `last_login` , `admin` , `orientation` , `ethnic` , `music` , `AIM` , `YIM` , `MSN` ,  )
VALUES (

'', '${username}', '{$pw}', '5000', '{$REMOTE_ADDR}', '{$email}', '{$fname}', '{$lname}', '{$gender}', '{$age}', '{$location}', '{$day}', '{$day}', '0', '{$orientation}', '{$ethnic}', '{$music}', '{$AIM}', '{$YIM}', '{$MSN}' );";


mysql_query("$sql1");

$sql1;
print "<center><font class=user>$username</font><br> You have sucessfully registered! ";

}

else{
[/code]

that's the top part.
in the else, is, nothing but echo's with html in it (for the table).


And, I don't get errors when I click register....
it says..
"mike
You have sucessfully registered!"
but, it never does anything...

so, help!!
Link to comment
Share on other sites

Alright. I'm gonna cut my IP and pw out though..

Error with query: INSERT INTO `users` ( `UID` , `username` , `password` , `points` , `IP` , `email` , `fname` , `lname` , `gender` , `age` , `location` , `registered` , `last_login` , `admin` , `orientation` , `ethnic` , `music` , `AIM` , `YIM` , `MSN` , ) VALUES ( '', 'mike', 'password', '5000', '12.12.123', 'mike@ataria.org', 'Michael', 'Ewing', 'Male', '15', 'New York', '20', '20', '0', 'Straight', 'White', 'Alternative', 'ewingggg', '', 'xxm1kexx@hotmail.com' );
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ( '', 'mike', 'password', '5000', '12.12.123', 'mike@ataria.org', 'M' at line 1
Link to comment
Share on other sites

Try this as the query:
[code=php:0]$sql1 = "INSERT INTO `users` (`username` , `password` , `points` , `IP` , `email` , `fname` , `lname` , `gender` , `age` , `location` , `registered` , `last_login` , `admin` , `orientation` , `ethnic` , `music` , `AIM` , `YIM` , `MSN` )
VALUES ('{$username}', '{$pw}', '5000', '{$REMOTE_ADDR}', '{$email}', '{$fname}', '{$lname}', '{$gender}', '{$age}', '{$location}', '{$day}', '{$day}', '0', '{$orientation}', '{$ethnic}', '{$music}', '{$AIM}', '{$YIM}', '{$MSN}' );";[/code]

also add the following:
[code=php:0]// help protect sql injection attacks
array_map('mysql_real_escape_string', $_POST, $_GET);[/code]

before:
[code=php:0]extract($_POST);[/code]
Link to comment
Share on other sites

i got...

Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/ataria/public_html/preview.php on line 8

and the other error thing...
Link to comment
Share on other sites

k. that error is gone.. but...

Error with query: INSERT INTO `users` ( `UID` , `username` , `password` , `points` , `IP` , `email` , `fname` , `lname` , `gender` , `age` , `location` , `registered` , `last_login` , `admin` , `orientation` , `ethnic` , `music` , `AIM` , `YIM` , `MSN` , ) VALUES ( '', 'mike', 'password', '5000', '12.12.123', 'mike@ataria.org', 'Michael', 'Ewing', 'Male', '15', 'New York', '20', '20', '0', 'Straight', 'White', 'Alternative', 'ewingggg', '', 'xxm1kexx@hotmail.com' );
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ( '', 'mike', 'password', '5000', '12.12.123', 'mike@ataria.org', 'M' at line 1

is still there...
Link to comment
Share on other sites

Thats using the old SQL query. The new on should be this:
[code=php:0]$sql1 = "INSERT INTO `users` (`username` , `password` , `points` , `IP` , `email` , `fname` , `lname` , `gender` , `age` , `location` , `registered` , `last_login` , `admin` , `orientation` , `ethnic` , `music` , `AIM` , `YIM` , `MSN` )
VALUES ('{$username}', '{$pw}', '5000', '{$REMOTE_ADDR}', '{$email}', '{$fname}', '{$lname}', '{$gender}', '{$age}', '{$location}', '{$day}', '{$day}', '0', '{$orientation}', '{$ethnic}', '{$music}', '{$AIM}', '{$YIM}', '{$MSN}' );";[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.