|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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(); |
|
#3
|
|||
|
|||
|
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] |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
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] |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > Need help w/ MySQL select in PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|