Hi,
I am trying to store a sql query in a database, but every time I try to read it, it shows all the code as text.
Here is the code on the page:
[php] $parts_sql = “SELECT * FROM parts WHERE part_cat = " . $category_row[‘cat_id’] . " ORDER BY CAST(part_a AS DECIMAL(10,2))”;
$parts_result = mysql_query($parts_sql);
if(!$parts_result)
{
echo '<tr><td>The parts could not be displayed, please try again later.</tr></td></table>';
}
else
{
while($parts_row = mysql_fetch_array($parts_result))
{
$pageformat_sql = "SELECT * FROM category_pages WHERE catpage_number = " . $category_row['cat_page'] . "";
$pageformat_result = mysql_query($pageformat_sql);
if(!$pageformat_result)
{
echo 'Error';
}
else
{
while($pageformat_row = mysql_fetch_assoc($pageformat_result))
{
$data = $pageformat_row['catpage_table'];
echo '<table class="table2 centre" style="width:750px">
' . $pageformat_row['catpage_tabletitle'] . '' . $data . '';
}
}
}}[/php]
And this is what is stored in the database table:
[php]
I would be very grateful to anyone who can help me with this.