I have this script…
<?php
//CONNECT TO THE DATABASE-------------------------------------------------------------------------
$con = mysql_connect("xxxxx", "xxxxxxx", "xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxxxxxx", $con);
//GET DATA FROM DATABASE --------------------------------------------------------------------------
$title_query = mysql_real_escape_string($_GET['product_code']);
$prods = mysql_query("
SELECT product_code, id, name, description, image
FROM products
WHERE product_code='$title_query'
");
//DISPLAY PRODUCT INFORMATION --------------------------------------------------------------------
{
while($row = mysql_fetch_array($prods))
{
echo $row['product_code'] . "<br />";
echo $row['id'] . "<br />";
echo $row['name'] . "<br />";
echo $row['description'] . "<br />";
echo "<img src='http://www.xxxxxxxxxx.co.uk/shop_images/product_thumbs/".$row['image'] . "' /><br />";
}
}
?>
So now this script will generate product information when I call the URL containing the product_code. What I was wondering is…
Would it be best to mix the HTML into this script or should I make a seperate template somehow to do this?
As you can probably tell I am brand new to PHP in the last few days. Can anyone give me some advice please?