Forum Moderators: coopster
//Query table to get data
$resultID = mysql_query("SELECT model_name, picture_location, short_description FROM fireplaces", $linkID);//start formatting the table
echo "<table width='0' border='0' cellpadding='0'>";
echo "<tr>";
//print the data inside table
while($row = mysql_fetch_row($resultID))
{
echo "<td width='100'><img src='th.php?name=$row[1]&height=100&width=100'></td>";
echo "<td width='245'>" . $row[0] . "<br><br>" . $row[2] . "</td>";
}
echo "</tr>";
echo "</table>";
Now I want people to click on a pic. and have a new page open up with all of the information about the stove. A description, price, heating capacity, blah blah blah. I have no idea how to do this. The th.php in the <img src tag was an image resizing script that my friend wrote and works perfectly. I'm extrememly new to php/mysql so any help is greatly appreciated. Especially, with the explanation. Thanks in advance.
You need to wrap the pic in an <a> element with an "href" attribute that points to the new page with all of the information about the stove. The href attribute could be another php page with a query string appended to it that specifies the key information necessary to retrieve that particular stove's details from the database table(s).
echo "<td width='100'><img src='th.php?name=$row[1]&height=100&width=100'></td>";
Thank you again for the help.
echo "<td width='100'><a href=stovedesc.php?=$row[0]><img src='th.php?name=$row[2]&height=100&width=100'></a></td>";
The problem I'm having is actually using the info. that is being passed to stovedesc.php. Nothing comes up. I know that's it's something I'm doing with the $_GET statement but I'm not sure what.
Here's the query I'm running (probably incorrect)
$resultID = mysql_query("SELECT fireplaceid, model_name, picture_location, long_description, price FROM fireplaces WHERE fireplaceid={$_GET['row']}", $linkID);
I am connecting to the db but can't get anything to print. I'm really sorry for my ignorance but the advice and help is greatly appreciated.
Rather than just show you right off where the issue lies, have a read through this post and look closely at the discussion and samples I offered.
[webmasterworld.com...]
See if you can get it figured out. If not, just post again and let us know and we'll be happy to get you over the hump.