FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

What is wrong with this MySQL query?

 


Fire Boar
I've tried everything... now it's the last resort: seeking help here. I've got a create table query for MySQL but it's not creating. Can someone point out what's wrong? Thanks.
Code:
$querycreate = <<<STRING

CREATE TABLE 'lottery_users' (
'id' INT(11) NOT NULL AUTO_INCREMENT,
'username' VARCHAR(25) NOT NULL,
'tickets' TINYINT(2) NOT NULL,
PRIMARY KEY ('id'),
INDEX ('tickets'),
UNIQUE ('username')
)

STRING;
mysql_query($querycreate);

And yes, I did define and log into the database properly: the script handles other stuff from that table as well and that works fine, it's just creating this table that's the problem.

Thanks.
jeremyyak
I don't really see anything wrong, it could be the apostrophes?

Try this:
Code:
CREATE TABLE lottery_users
(
id INT(11) NOT NULL AUTO_INCREMENT,
username VARCHAR(25) NOT NULL,
tickets TINYINT(2) NOT NULL,
PRIMARY KEY(id),
INDEX(tickets),
UNIQUE(username)
);


Hope you get it working.
~Jeremy~
Fire Boar
Yes, that works, thanks.
raver
next time don't add them, or use ` between them, like:
INSERT INTO `lottery_users`(id, name) VALUES('1', 'proper way to use quotes:D');
Related topics

Help with mysql query
MySQL Query Cache
whats wrong with this mysql query?
what is wrong with this query? Please please help!
MySQL connection

I'm doing something wrong,,,
MySQL Query help
MySQL
n00b mySQL question :D
AJAX tutorial [2nd part now updated]

mySQL Query/PHP code - get the highest value...
mySQL Query Problem
[Edit] mySQL Count
How to search in a MySQL - database
PHP MySQL Question
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.