Can anyone help with the following as its driving me insane! Probably something really obvious but it has fried my brain now!
I have two tables, Categories_stores, Categories_description.
Ok put in english this is what i want to happen:
I want to look into the stores table and select all the rows that are equal to a variable 'GLOBAL_CURRENT_STORE_NAME' obviously theae are all in the same column (categories_storename)
This will give a big long list of numbers from this table under categories_id.
I then want this column to be used to select all the corresponding records out of the categories description_table
The sql i currently have is:
$categories_query = tep_db_query("SELECT cd.categories_id, categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES_STORES . " cs WHERE language_id = $this_language_id and cd.categories_id = cs.categories_id and cs.categories_storename = '" . GLOBAL_CURRENT_STORE_NAME . "' ORDER BY categories_name");
This just brings up the following error:
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 'and cd.categories_id = cs.categories_id and cs.categories_store
Am i missing something really obvious! Any help would be much apreciated!