TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-18-2008, 04:41 PM   #1 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default query synatx

Code:
CREATE TABLE IF NOT EXISTS users (
        id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
        username VARCHAR(255) NOT NULL ,
        password VARCHAR(255) NOT NULL ,
        email TEXT NOT NULL ,
        ip VARCHAR(16) NOT NULL ,
        group INT(1) NOT NULL DEFAULT 1 ,
        banned VARCHAR(5) NOT NULL DEFAULT 'n'
        );";
produces this error...

Quote:
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 'group INT(1) NOT NULL DEFAULT 1 , banned VARCHAR(5) NOT NULL DEFAULT 'n' at line 7
why? i've used this exact query string in the past, but now it doesn't work?
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Old 07-18-2008, 06:19 PM   #2 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

Try this:
Code:
CREATE TABLE IF NOT EXISTS `users` ( `id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
`username` VARCHAR( 255 ) NOT NULL ,
`password` VARCHAR( 255 ) NOT NULL ,
`email` TEXT NOT NULL ,
`ip` VARCHAR( 16 ) NOT NULL ,
`group` INT( 1 ) NOT NULL DEFAULT '1',
`banned` VARCHAR( 5 ) NOT NULL DEFAULT 'n',
PRIMARY KEY ( `id` ) 
) ENGINE = MYISAM
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
The Following User Says Thank You to drewbee For This Useful Post:
Evulness (07-18-2008)
Old 07-18-2008, 06:50 PM   #3 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default

Thank you :)
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Old 07-21-2008, 04:04 PM   #4 (permalink)
The Contributor
 
buggabill's Avatar
 
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
buggabill is on a distinguished road
Default

The reason your query failed is that GROUP is a reserved word in MySQL. Be careful in your queries down the road as they will all require the backticks surrounding that field name.

You may wish to change this now to save headaches later.
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
buggabill is offline  
Reply With Quote
Old 07-21-2008, 04:22 PM   #5 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

This is why I always use ticks on my queries, always. It is bad practice to use a keyword for a name, but it just makes things more bug-proof.
__________________

Village Idiot is offline  
Reply With Quote
Old 07-22-2008, 01:29 PM   #6 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default

OMG LOL i totaly forgot about GROUP.

Sorry it has been a hectic week. been 2 weekends working on my bathroom, and working double time on other side projects during the week, after coming home from working my 9-5....

I would have used ticks ( ` )'s but the server i'm using these scripts on doesn't like them.
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Old 07-22-2008, 07:46 PM   #7 (permalink)
The Contributor
 
Join Date: Apr 2005
Location: Kent, UK
Posts: 54
Thanks: 0
Dr John is on a distinguished road
Default

I'd suggest replacing group with groups or with grp, then the requirement to add ticks goes away.
__________________
www.kidneydialysis.org.uk
Dr John is offline  
Reply With Quote
Old 07-23-2008, 01:23 PM   #8 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default

Querys been fixed.

now i just need to set up some functions to pull and display my articles.
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:58 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design