#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    25
    Rep 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
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    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();

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    25
    Rep 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]

  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    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.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    25
    Rep 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]

Similar Threads

  1. Check MySQL Version thru PHP
    By wolftrap1 in forum PHP Development
    Replies: 2
    Last Post: February 11th, 2004, 08:51 PM
  2. Replies: 5
    Last Post: February 11th, 2004, 02:18 AM
  3. Replies: 0
    Last Post: February 10th, 2004, 11:44 PM
  4. Replies: 0
    Last Post: January 30th, 2004, 01:22 PM
  5. php wont output mysql data
    By tanjafei in forum PHP Development
    Replies: 1
    Last Post: January 27th, 2004, 08:40 PM

IMN logo majestic logo threadwatch logo seochat tools logo