Thank you in advance for taking the time to work through my issue.
I am using a PHP script to query a mySQL database. Unfortunately, the product description, ingredients, and additional information (the paragraph at the very end) are all stored in one single field, along with the name (the name is redundant and can just be ignored). All of the text is surrounded in HTML code. I do not want to keep or store any HTML code, but it may be useful as delimiters.
Important: the HTML is stored encoded, so
<p>
is stored as
<p>
Here is an example of HTML code that is stored in the mySQL database (this is the exact way it is stored. As I mentioned earlier, the HTML is encoded.):
<table border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr valign="top">
<td>
Item:</td>
<td>
Olive Loaf - Baked - <b>Gluten Free!</b></td>
</tr>
<tr valign="top">
<td>
Description:</td>
<td>
A blend of beef and pork along with our unique spices to create a base mix. To this mix we add plenty of olives and form it into a loaf, we then smoke this over natural hardwoods for a unique Koegel flavor.</td>
</tr>
<tr valign="top">
<td>
Ingredients:</td>
<td>
Beef and Pork, Water, Spanish Olives (Olives, Pimentos, Sodium Alginate, Guar Gum, Calcium Chloride, Water, Salt, Lactic Acid), Nonfat Dry Milk, Corn Syrup, Salt, Red Sweet Peppers (bell peppers, water, citric acid.), Spices, Dextrose, Dehydrated Onions.</td>
</tr>
</tbody>
</table>
<p>
<strong>Each loaf weighs approximately 6 lbs.</strong></p>
Here is the same code snippet with the HTML decoded (this is NOT how it is stored in the mySQL database. I provided this just for a visual.):
<table border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr valign="top">
<td>
Item:</td>
<td>
Olive Loaf - Baked - <b>Gluten Free!</b></td>
</tr>
<tr valign="top">
<td>
Description:</td>
<td>
A blend of beef and pork along with our unique spices to create a base mix. To this mix we add plenty of olives and form it into a loaf, we then smoke this over natural hardwoods for a unique Koegel flavor.</td>
</tr>
<tr valign="top">
<td>
Ingredients:</td>
<td>
Beef and Pork, Water, Spanish Olives (Olives, Pimentos, Sodium Alginate, Guar Gum, Calcium Chloride, Water, Salt, Lactic Acid), Nonfat Dry Milk, Corn Syrup, Salt, Red Sweet Peppers (bell peppers, water, citric acid.), Spices, Dextrose, Dehydrated Onions.</td>
</tr>
</tbody>
</table>
<p>
<strong>Each loaf weighs approximately 6 lbs.</strong></p>
Basically, I want to ignore the name, save the Description and Additional Information (the last paragraph below the description) as $productDescription (perhaps add two newline characters after the description to separate the additional information), and save the ingredients as $productIngredients. I do not want to include the text "Description:" or "Ingredients:" ... just the information immediately after. As stated above, I am only interested in the raw text - I do not want to save any of the HTML code. All HTML code should be ignored when storing the information into the 2 variables.
Any help is well-appreciated!
Thank you,
-Jeff
EDIT
What's going on is the mySQL database is connected to an opencart website. On the admin side of the website, there are no separate fields for ingredients, description, etc. There's about everything else (weight, dimensions, SKU, model, etc.). This is because the opencart website is not exclusively for food. It can be used for electronics, in which case there would be no need for such fields. The store owner (not me) feeds all of this information into the description entry point. The HTML may give this away. The website is managed by another individual (I have direct contact to him if need be). I would prefer not to have him nor myself alter the opencart code to add the extra fields, unless it can be easily done.
Would it be easy to add additional fields to an opencart website? That way, the description field can be exclusive. Thanks for the replies.
"product description, ingredients, and additional information are all stored in one single field"is a developer's living nightmare.