M
Mr E
Guest
hello,
i need to create a function (i think it will be a looping function) that basically creates a table to put data in taken from a mysql statement
currenly the method i'm using merely puts the gatehred results in either a horizontal or a vertical line.
the data i get from the mysql database is the name of the product and the thumb image of the product (which are doors)
as you will see by the code, also when you click on an image, it also enlarges the image. this will be getting in time but is irrelevent for this particular question i'm posting
my current code is at the bottom. i've tried a few methods but still haven't got anywhere, from trying to find the answer i have only found that it involves some sort of loop array and table.
i'd be greatful to anyone who can crack this
$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
// gathers the door name the final price and the thumbnail for all doors that have Arbury in their name
$result = mysql_query("SELECT DoorName, Thumbimage FROM tblpricelist WHERE DoorName like '%Arbury%'");
for ($i=0; $i<3&&$row = mysql_fetch_array($result); $i++)
{
echo " <img src='./thumb/". $row['Thumbimage']."' onmousedown=\"this.src='./large/". $row['Thumbimage']."'\" onmouseup=\"this.src='./thumb/". $row['Thumbimage']."'\"/>";
echo "<br />";
echo $row['DoorName'];
echo "<br />";
}
?>
i need to create a function (i think it will be a looping function) that basically creates a table to put data in taken from a mysql statement
currenly the method i'm using merely puts the gatehred results in either a horizontal or a vertical line.
the data i get from the mysql database is the name of the product and the thumb image of the product (which are doors)
as you will see by the code, also when you click on an image, it also enlarges the image. this will be getting in time but is irrelevent for this particular question i'm posting
my current code is at the bottom. i've tried a few methods but still haven't got anywhere, from trying to find the answer i have only found that it involves some sort of loop array and table.
i'd be greatful to anyone who can crack this
$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
// gathers the door name the final price and the thumbnail for all doors that have Arbury in their name
$result = mysql_query("SELECT DoorName, Thumbimage FROM tblpricelist WHERE DoorName like '%Arbury%'");
for ($i=0; $i<3&&$row = mysql_fetch_array($result); $i++)
{
echo " <img src='./thumb/". $row['Thumbimage']."' onmousedown=\"this.src='./large/". $row['Thumbimage']."'\" onmouseup=\"this.src='./thumb/". $row['Thumbimage']."'\"/>";
echo "<br />";
echo $row['DoorName'];
echo "<br />";
}
?>