Jump to content

Mysql Query Code Help.


Hypersource

Recommended Posts

heres my code:

 

 

 

$sql="

INSERT INTO `a8392424_pets`.`users` (

`user_id` ,

`user_name` ,

`user_pass` ,

`user_email` ,

`user_date` ,

`user_level` ,

`posts` ,

`married` ,

`cash` ,

`tokens`

)

VALUES (

NULL, '" . mysql_real_escape_string($_POST['user_name']) . "', '" . sha1($_POST['user_pass']) . "', '" . mysql_real_escape_string($_POST['user_email']) . "', NOW(),'0', 'noone', '10000', '10')";

$result = mysql_query($sql);

if(!$result)

{

//something went wrong, display the error

echo 'Something went wrong while registering. Please try again later.';

//echo mysql_error(); //debugging purposes, uncomment when needed

}

 

 

When I execute it, using my signup form, the query fails. my connection to database is GOOD.

Link to comment
https://forums.phpfreaks.com/topic/270955-mysql-query-code-help/
Share on other sites

As mrMarcus said.

 

user_id is probably an auto increment field, so you can delete the line

 

`user_id` ,

 

 

if it still doesn't work, uncomment

 

"//echo mysql_error(); //debugging purposes, uncomment when needed".

and comeback with a decent error message.

 

it even says right there. "debugging purposes. uncomment when needed".

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.