Jump to content

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?
Link to comment
https://forums.phpfreaks.com/topic/11565-show-more-details/
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.
Link to comment
https://forums.phpfreaks.com/topic/11565-show-more-details/#findComment-43572
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.