Jump to content

MySQL Email Datatype


ervisboy007

Recommended Posts

Hi,

 

$tableSQL = "CREATE TABLE Members
		(
			UserName varchar(15),
			PassWord varchar(15),
			EMail varchar(15),
			JoinDate varchar(15)
		)"

 

$sqlquery = "INSERT INTO Members (UserName, PassWord, EMail, JoinDate)
					VALUES($username, $password, $email, $joindate)";

 

When I use my form to register an account, I get this:

"An error occured: 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 '@hotmail.com, 03-Mar-2010)' at line 2"

 

Here is the site if you want to take a look at:

http://cegames.megabyet.net/Sancum/register.html

 

 

Thanks,

Ervisboy007

 

EDIT:

MySQL version  5.0.87-community-log

PHP version 5.2.11

Link to comment
Share on other sites

Hi,

 

 

I change it to varchar(45) but I still think that that's not the problem.

 

An error occured: 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 '@hotmail.com, 03-Mar-2010)' at line 2

 

does MySQL have a special datatype for emails? maybe the '@' is causing the problem? could it be that my table is setup wrong?

 

Thanks,

Ervisboy007

Link to comment
Share on other sites

Hi,

 

this is what I get:

 

username, password, email, joindate

tester
test
test@hotmail.com
04-Mar-2010
An error occured: 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 '@hotmail.com, 04-Mar-2010)' at line 2

Link to comment
Share on other sites

Hi,

 

thanks for the warning, but now, I have another error :P

 

Error: 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 'CURDATE(), PRIMARY KEY (MemberID) )' at line 7

 

$tableSQL = "CREATE TABLE Members
		(
		 	MemberID int(11) unsigned NOT NULL auto_increment,
			UserName varchar(30) NOT NULL default '',
			PassWord varchar(32) NOT NULL default '',
			EMail varchar(50),
			JoinDate date NOT NULL DEFAULT CURDATE(),
			PRIMARY KEY (MemberID)
		)";

 

$sqlquery = "INSERT INTO Members (UserName, PassWord, EMail)
	    VALUES('$username', '$password', '$email')";

 

Should I use unsigned for the JoinDate too?

 

Thanks,

Ervisboy007

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.