Jump to content

Archived

This topic is now archived and is closed to further replies.

nritchie2004

Show more details

Recommended Posts

Hi, I hope someone can help me here, Id really like to be able to have on my site a link which then opens another page, but with more details than the previous. eg: I have a page which outputs boats from the database, and the things shown are Boat Name, Boat Type, and Price, and then under this i would like a link, that open a page which shows Boat Name, Boat Type, Price, Features and Description. How would i go about doing this?

Share this post


Link to post
Share on other sites
for the first page output the boats as an array of the boat list

[code]
<table>
<?
$sql = mysql_query ("select * from `boats` WHERE 1 ORDER BY `added_time` DESC LIMIT 0, 10");
if ($mysql_num_rows ($sql) != 0)
{
  while ($sql_data = mysql_fetch_array ($sql))
  {
    ?><tr><td><a href="?boat=<?=$sql_data['boat_id']?>"><?=$sql_data['boat_name']?></a></td></tr><?
  }
}
?></table>
[/code]

the other page:

[code]
<? if (!isset ($_GET['boat']) || !mysql_result (mysql_query ("select `boat_id` from `boats` where `boat_id` = '".$_GET['boat']."'"), 0)) die ("No boat selected");

$boat_data = mysql_fetch_array (mysql_query ("select * from `boats` where `boat_id` = '".$_GET['boat']."'"));

?><?=$boat_data['boat_name']?><?=$boat_data['boat_length']?>...etc
[/code]

The thing to remember is just have the main page listing and the second selecting. The first page here selects a certain range from the list of boats, giving you a link which includes the boat_id from the DB, letting the other page know what information to retreive.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.