Current location: Hot Scripts Forums » Programming Languages » PHP » MySQL Query problem


MySQL Query problem

Reply
  #1 (permalink)  
Old 03-06-04, 02:58 PM
Wraith Wraith is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL Query problem

Hi there,
I'm trying to get my query to do this:
CREATE TABLE `tbl_Cheats_GC` (
`A` TEXT NOT NULL,
`B` TEXT NOT NULL
`C` TEXT NOT NULL,
`D` TEXT NOT NULL,
`E` TEXT NOT NULL,
`F` TEXT NOT NULL,
`G` TEXT NOT NULL,
`H` TEXT NOT NULL,
`I` TEXT NOT NULL,
`J` TEXT NOT NULL,
`K` TEXT NOT NULL,
`L` TEXT NOT NULL,
`M` TEXT NOT NULL,
`N` TEXT NOT NULL,
`O` TEXT NOT NULL,
`P` TEXT NOT NULL,
`Q` TEXT NOT NULL,
`R` TEXT NOT NULL,
`S` TEXT NOT NULL,
`T` TEXT NOT NULL,
`U` TEXT NOT NULL,
`V` TEXT NOT NULL,
`W` TEXT NOT NULL,
`X` TEXT NOT NULL,
`Y` TEXT NOT NULL,
`Z` TEXT NOT NULL,
)
BUT, I get this error: You have an error in your SQL syntax near 'C` TEXT NOT NULL,
`D` TEXT NOT NULL,
`E` TEXT NOT NULL,
`F` TEXT NOT NULL,' at line 4

Any ideas please?

-Wraith

~~EDIT~~
Ok, thats fixed (no , at the end of line B), now i get this error: You have an error in your SQL syntax near ')' at line 28

Last edited by Wraith; 03-06-04 at 03:04 PM.
Reply With Quote
  #2 (permalink)  
Old 03-06-04, 03:04 PM
jerry's Avatar
jerry jerry is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Solution..

The problem lies just after `B`, where a comma is missing and after `Z`, where a comma should not be.
Hope this helps.

Quote:
Originally Posted by Wraith
Hi there,
I'm trying to get my query to do this:
CREATE TABLE `tbl_Cheats_GC` (
`A` TEXT NOT NULL,
`B` TEXT NOT NULL
`C` TEXT NOT NULL,
`D` TEXT NOT NULL,
`E` TEXT NOT NULL,
`F` TEXT NOT NULL,
`G` TEXT NOT NULL,
`H` TEXT NOT NULL,
`I` TEXT NOT NULL,
`J` TEXT NOT NULL,
`K` TEXT NOT NULL,
`L` TEXT NOT NULL,
`M` TEXT NOT NULL,
`N` TEXT NOT NULL,
`O` TEXT NOT NULL,
`P` TEXT NOT NULL,
`Q` TEXT NOT NULL,
`R` TEXT NOT NULL,
`S` TEXT NOT NULL,
`T` TEXT NOT NULL,
`U` TEXT NOT NULL,
`V` TEXT NOT NULL,
`W` TEXT NOT NULL,
`X` TEXT NOT NULL,
`Y` TEXT NOT NULL,
`Z` TEXT NOT NULL,
)
BUT, I get this error: You have an error in your SQL syntax near 'C` TEXT NOT NULL,
`D` TEXT NOT NULL,
`E` TEXT NOT NULL,
`F` TEXT NOT NULL,' at line 4

Any ideas please?

-Wraith
__________________
<font face="Verdana"><a href="http://www.generalscripting.com">General Scripting</a> Web Development Services</font>
Reply With Quote
  #3 (permalink)  
Old 03-06-04, 03:05 PM
Wraith Wraith is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
ty m8

Now I need help with this:
DB = themn
Table = tbl_nintendo
Table2= tbl_xbox
Table3= tbl_ps2

In each table there would be parts (A, B, C, D, E etc)
If they selected E and there was no data, how could I put an error? And if there was more data (game names) in there, and they selected one, how would it get the cheats for that game (Your really deep into the db now).

-Wraith
Reply With Quote
  #4 (permalink)  
Old 03-06-04, 03:16 PM
jerry's Avatar
jerry jerry is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Wraith..

There need to be more tables.
The tables you mentioned below are for GAME TITLES for the respective console. Each table should have only 2 colums, basically they are:
1) ID
2) Game Title
There shouldn't be parts A,B,C,D,E... There's no need for it.

The second complimentary table would be called ninendo_cheats, xbox_cheats, ps2_cheats, etc.

They should in return hold the cheats for individual games. Again, they will contain 2 columms
1) ID ( the key taken from the Games Table )
2) Cheats ( the text for the cheats for this particular game, whose id is referenced from the other table).

Alternatively, you could combine everything into one table, by simply inserting a 'cheat' column into the first table, thus making it a three column table.

Anyway, do consider General Scripting to deliver you such a service if you ever need someone to do it. We can accomplish that, a multi-paging page slider system, a search engine to search for your cheats, sorting criterias as well as keyword highlighting.


Quote:
Originally Posted by Wraith
ty m8

Now I need help with this:
DB = themn
Table = tbl_nintendo
Table2= tbl_xbox
Table3= tbl_ps2

In each table there would be parts (A, B, C, D, E etc)
If they selected E and there was no data, how could I put an error? And if there was more data (game names) in there, and they selected one, how would it get the cheats for that game (Your really deep into the db now).

-Wraith
__________________
<font face="Verdana"><a href="http://www.generalscripting.com">General Scripting</a> Web Development Services</font>
Reply With Quote
  #5 (permalink)  
Old 03-06-04, 03:47 PM
Wraith Wraith is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Great ta!
Now, What about counting how many H's are in the ID colum?

-Neo
Reply With Quote
  #6 (permalink)  
Old 03-06-04, 05:16 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Quote:
Originally Posted by Wraith
~~EDIT~~
Ok, thats fixed (no , at the end of line B), now i get this error: You have an error in your SQL syntax near ')' at line 28
after `Z` TEXT NOT NULL, remove the comma... commas separate items, so you don't need one after the last item.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Expert Required!! Advanced Query Problem bluey_the_punch PHP 1 02-28-04 01:37 PM
help query result mysql php paceno11 PHP 1 02-19-04 02:18 AM
PHP:search by MySQL query lowdog PHP 0 02-15-04 10:04 AM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 09:12 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.