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
https://forums.phpfreaks.com/topic/194061-mysql-email-datatype/
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

Hi,

 

this is what I get:

 

username, password, email, joindate

tester
test
[email protected]
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

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

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.