laanes Posted June 21, 2010 Share Posted June 21, 2010 Navigation Links coming from a database table 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. Link to comment https://forums.phpfreaks.com/topic/205419-navigation-links-coming-from-a-database-table/ Share on other sites More sharing options...
Pikachu2000 Posted June 21, 2010 Share Posted June 21, 2010 SELECT `cat_id` FROM `CubeCart_category` WHERE `cat_father_id` = 'HAND TOOLS' // strings need to be quoted in query strings, integers do not. If you change the data type for cat_id to varchar (which I'd recommend not doing, BTW), you'll need to make sure to use a UNIQUE index on that field, as it appears to serve as the table's index. If you change it, it will likely cause you a whole host of other problems. Link to comment https://forums.phpfreaks.com/topic/205419-navigation-links-coming-from-a-database-table/#findComment-1075002 Share on other sites More sharing options...
rami103 Posted June 21, 2010 Share Posted June 21, 2010 put string in single qoutes SELECT cat_id FROM CubeCart_category WHERE cat_father_id = 'HAND TOOLS' Link to comment https://forums.phpfreaks.com/topic/205419-navigation-links-coming-from-a-database-table/#findComment-1075004 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.