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
https://forums.phpfreaks.com/topic/22592-ugh-registration-error/
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', '[email protected]', 'Michael', 'Ewing', 'Male', '15', 'New York', '20', '20', '0', 'Straight', 'White', 'Alternative', 'ewingggg', '', '[email protected]' );
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', '[email protected]', 'M' at line 1
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]
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...
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', '[email protected]', 'Michael', 'Ewing', 'Male', '15', 'New York', '20', '20', '0', 'Straight', 'White', 'Alternative', 'ewingggg', '', '[email protected]' );
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', '[email protected]', 'M' at line 1

is still there...
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]

Archived

This topic is now archived and is closed to further replies.

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