Page 1 of 1

Navigation Links coming from a database table

Posted: Mon Jun 21, 2010 8:22 am
by laanes
I am using CubeCart to hopefully sell products in the near future.

I have a menu that goes multiple levels down and I am trying to load the menu straight from a database table.

I also want the cat_id and cat_father_id to be letters(varchar) instead of auto incrementing numbers.

Does anyone know is this is possible and maybe even how to do it?

At the moment i get the following feedback:

Error Message:
1064: 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 'TOOLS' at line 1

SQL:
SELECT cat_id FROM CubeCart_category WHERE cat_father_id = HAND TOOLS

The error does not appear when I change cat_father_id back to an auto_incrementing integer. I need it to be VARCHAR.

If anyone feels that he might be able to help then let me know what additional information would you need.

Thank You to everyone who will share any ideas/thoughts.

Re: Navigation Links coming from a database table

Posted: Mon Jun 21, 2010 11:59 am
by AbraCadaver
Text needs to be quoted:

Code: Select all

SELECT cat_id FROM CubeCart_category WHERE cat_father_id = 'HAND TOOLS'
But you are probably destroying your database with this approach. If it was an auto increment int you should leave it, then in some other table there is probably that same int that relates back to this one, with another field like category_name and it contains HAND TOOLS.