Well I've made some good progress today, it's been really slow tho.
This is what I've managed
I've took the xml datafeed and selected chose three details name, thumbnail and price.
Set up a mysql database table to accept the three items
Inserted the three items
Displayed the contents of the database
All pretty basic stuff but it's a bit of a steep learning curve when you're just starting out.
<?php
$username="####your database username####";
$password="###your database password####";
$database="philb_bdolls";
?>
<?php
include('../shop/dbconn.php');
$con = mysql_connect(localhost,$username,$password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("philb_bdolls", $con);
$xml = simplexml_load_file("../shop/datafeed_79329.xml");
foreach($xml->merchant->prod as $product){
$name = $product->text->name;
$awThumb = $product->uri->awThumb;
$buynow = $product->price->buynow;
$mcat = $product->cat->mCat;
$awTrack = $product->uri->awTrack;
$descrip = $product->text->desc;
mysql_query("INSERT INTO shop (name, awThumb, buynow, mcat, awtrack, descrip)
VALUES ('$name', '$awThumb', '$buynow', '$mcat', '$awTrack', '$descrip')");
}
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
<?php
include('../dbconn.php');
$con = mysql_connect(localhost,$username,$password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("philb_bdolls", $con);
//SELECT * FROM tablename WHERE field1-name='1'
$query="SELECT * FROM shop WHERE mcat='Bondage Kits' ORDER BY buynow ASC";
$result=mysql_query($query);
$nrows = mysql_num_rows($result);
echo "<table>";
for ($i=0;$i<$nrows;$i++)
{
$n = $i + 1;
$row = mysql_fetch_array($result);
extract($row);
?>
<table border="0" cellpadding="0" cellspacing="10">
<tr>
<td><a href="<?php echo $awtrack ?>"><img src="<?php echo $awThumb ?>" width="80" /></a></td>
<td width="400" valign="top" class="descrip"><a href="<?php echo $awtrack ?>"><?php echo $name ?></a><br />
<span class="descript"><?php echo $descrip; ?> <a href="<?php echo $awtrack ?>">...read more</a></span></td>
<td width="100" valign="top">£ <?php echo $buynow; ?></td>
</tr>
<?php
}
?>
It looks good, when displaying search terms you will need some sort of spam filter!
We use essential cookies to make this site work, and optional cookies to enhance your experience.