hungryfrank Posted November 12, 2016 Share Posted November 12, 2016 i am getting the result correctly entered in the db with this code. unfortunately i need the data that enters the db changed a little. i want when the value of $value->CategoryParentID is equal to the $value->CategoryID 0 be entered instead of $value->CategoryParentID. $results = new SimpleXMLElement($responseXml); } if ($results->Ack == "Success") { echo tep_db_query("truncate table ebay_categories_description"); tep_db_query("truncate table ebay_categories"); $c = 0; foreach ($results->CategoryArray->Category as $key => $value) { ///// i need to find out if the two values are equal here tep_db_query("insert into ebay_categories (categories_id, parent_id) values (" . $value->CategoryID . ", " . $value->CategoryParentID .")"); tep_db_query("insert into ebay_categories_description (categories_id, categories_name) values (" . $value->CategoryID . ", '" . addslashes($value->CategoryName) . "')"); $c++; } //$results->CategoryArray->Category as $key => $value echo $c . " categories inserted successfully!<br>"; } //$results->Ack == "Success" else { echo "get categories error<br>"; } but when i use an if statement it breaks the process Quote Link to comment https://forums.phpfreaks.com/topic/302517-need-help-with-comparing-values-while-parsing-an-xml-file/ Share on other sites More sharing options...
requinix Posted November 12, 2016 Share Posted November 12, 2016 What have you tried and how did it not work? Quote Link to comment https://forums.phpfreaks.com/topic/302517-need-help-with-comparing-values-while-parsing-an-xml-file/#findComment-1539232 Share on other sites More sharing options...
hungryfrank Posted November 12, 2016 Author Share Posted November 12, 2016 (edited) resolved i had to use (int) thanks Edited November 12, 2016 by hungryfrank Quote Link to comment https://forums.phpfreaks.com/topic/302517-need-help-with-comparing-values-while-parsing-an-xml-file/#findComment-1539233 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.