Jump to content
The mkiv Supra Owners Club

php gurus?


Guest adi-mkiiisupra

Recommended Posts

Guest adi-mkiiisupra

Hi all...

 

i desperately need help on a fairly simple php script, which is part of a bigger page on an OScommerce...

 

The following loops round inserting a relationship into a table. The problem is that i only want this to happen IF an entry in a column 'parent_id' in table 'categories' has a value OTHER than that of zero. but i cant get it to work !!!!

 

Heres the normal script..

 

PS $current_category_id can be thought of as the row for the categories table.

 

# create loop here to insert rows for multiple categories
$selected_catids = $HTTP_POST_VARS['categories_ids'];
 
if ($selected_catids)
{
	foreach ($selected_catids as $current_category_id)
	{
	tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $products_id . "', '" . $current_category_id . "')");
	}
}

 

 

I've been told to use something like..

 

if ($current_category_id == 0){ continue;} above the insert into tep command. Which works based on $current_category_id, but not when i try and retrieve the parent_id from the database..

 

Can anyone help???

Its driving me mad...

Link to comment
Share on other sites

Guest adi-mkiiisupra

php forums are notoriously slow to reply to things :D if they do at all !!besides i though we had a lot of IT peeps on here?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. You might also be interested in our Guidelines, Privacy Policy and Terms of Use.