M
Mr E
Guest
I have a bit of a problem with my php based website?
hello,
i need to create a function (i think it will be a looping function) that basically gets data from a mySQL database and displays on the webpage in a table(not mySQL more <td> style table) that is say 4 or 5 rows in length then moves down a column and fills another 4 or 5 rows, until all doors (with their names are displayed on the web page)
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 "
";
echo $row['DoorName'];
echo "
";
}
?>
if anyone has any ideas on how to do this i will be greatful
hello,
i need to create a function (i think it will be a looping function) that basically gets data from a mySQL database and displays on the webpage in a table(not mySQL more <td> style table) that is say 4 or 5 rows in length then moves down a column and fills another 4 or 5 rows, until all doors (with their names are displayed on the web page)
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 "
";
echo $row['DoorName'];
echo "
";
}
?>
if anyone has any ideas on how to do this i will be greatful