Guest adi-mkiiisupra Posted January 18, 2006 Share Posted January 18, 2006 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 More sharing options...
Guest adi-mkiiisupra Posted January 18, 2006 Share Posted January 18, 2006 anyone? c'mon.. this is easy php stuff to anyone who knows it surely.. Link to comment Share on other sites More sharing options...
stt Posted January 18, 2006 Share Posted January 18, 2006 Have you not tried asking on the phpBB forum? They will have the answer without doubt! Link to comment Share on other sites More sharing options...
Guest adi-mkiiisupra Posted January 18, 2006 Share Posted January 18, 2006 php forums are notoriously slow to reply to things if they do at all !!besides i though we had a lot of IT peeps on here? Link to comment Share on other sites More sharing options...
Guest adi-mkiiisupra Posted January 23, 2006 Share Posted January 23, 2006 apparently not sorted now anyway. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now