PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 10th, 2000, 01:55 AM
bbarker bbarker is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 25 bbarker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I hope I can explan this properly. I've got an app where you can assign an item to several different categories. The category information (id,cat name and cat icon) is in it's own table and is not changed - just read. Each item can be part of one or more categories and each category has it's own icon. When displayed, you would see the item listed and the icons representing each category the item belongs to. The only table being written to is the one that contains the array info (item 1 is part of cats 2,4 and 5, etc).

My problem is that I'm trying to list all the items and the category icons without resorting to case statements or if/then statements as there are over 15 categories and it takes a long time to run through all the arrays and list everything. Using in the myAdmin tool to query the db, I can use the
query below and it works fine...

select selected,icon from selections,categories where selections.sid=$variable and
selections.selected=categories.catID

however, when I stick into a php/mySQL select it bombs telling me '0 is not a valid....'. I'm guessing it has something to do with the last part of the select but can't begin to guess what I'm missing or how to fix it.

Any help would be greatly appreciated - I'd sure like to dump those big if statements! Thanks and sorry for the longish explanation.

bob

Reply With Quote
  #2  
Old February 10th, 2000, 06:20 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
The first step would be to print the mysql_error() received so you can see what mysql is complaining about. On the line after your mysql_query() just put:

print mysql_error();


Reply With Quote
  #3  
Old February 10th, 2000, 12:54 PM
bbarker bbarker is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 25 bbarker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Okay, I'm getting:

Got error 134 from table handler

I've checked my O'Reilly and the mySQL website but have not found a list of error codes yet.

Bob


<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by rod k:
The first step would be to print the mysql_error() received so you can see what mysql is complaining about. On the line after your mysql_query() just put:

print mysql_error();
[/quote]


Reply With Quote
  #4  
Old February 10th, 2000, 06:01 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
Hmmm. That sounds like a corrupt table. If it was syntactical or logical you'd get a true text message of the error. That's an internal mysql error meaning something is wacko.

Reply With Quote
  #5  
Old February 10th, 2000, 06:53 PM
bbarker bbarker is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 25 bbarker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That must be it - using 2 completely different tables, I cobbled together a similar search as a test and it came up with the same results as a direct db query. Changed things back and whammo. I'll see what I can do to either repair or rebuild the db. Thanks so much for all your help - I really appreciate it!


<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by rod k:
Hmmm. That sounds like a corrupt table. If it was syntactical or logical you'd get a true text message of the error. That's an internal mysql error meaning something is wacko.[/quote]


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Need help w/ MySQL select in PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT