Jump to content


Photo

Show more details


  • Please log in to reply
1 reply to this topic

#1 nritchie2004

nritchie2004
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 June 2006 - 09:33 AM

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?

#2 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 09 June 2006 - 10:21 AM

for the first page output the boats as an array of the boat list

<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>

the other page:

<? 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

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.
z..z..z..z..z..z..z..z..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users