Jump to content

need help with comparing values while parsing an xml file


hungryfrank

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.