Jump to content


Photo

Implement "Go to Detail Page" on DreamweaverMX


  • Please log in to reply
No replies to this topic

#1 bigholy

bigholy
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 13 November 2003 - 06:47 PM

Recently I found a way to create \"go to detail page \"on DWMX.now share it with all.
At first,I name index.php as the main page,detail.php as detail page.
Here is source code as follows:

//index.php

<?php require_once(\'Connections/conntest.php\'); ?>
<?php
$maxRows_rsdir = 10;
$pageNum_rsdir = 0;
if (isset($_GET[\'pageNum_rsdir\'])) {
$pageNum_rsdir = $_GET[\'pageNum_rsdir\'];
}
$startRow_rsdir = $pageNum_rsdir * $maxRows_rsdir;

mysql_select_db($database_conntest, $conntest);
$query_rsdir = \"SELECT * FROM usrinfo\";
$query_limit_rsdir = sprintf(\"%s LIMIT %d, %d\", $query_rsdir, $startRow_rsdir, $maxRows_rsdir);
$rsdir = mysql_query($query_limit_rsdir, $conntest) or die(mysql_error());
$row_rsdir = mysql_fetch_assoc($rsdir);

if (isset($_GET[\'totalRows_rsdir\'])) {
$totalRows_rsdir = $_GET[\'totalRows_rsdir\'];
} else {
$all_rsdir = mysql_query($query_rsdir);
$totalRows_rsdir = mysql_num_rows($all_rsdir);
}
$totalPages_rsdir = ceil($totalRows_rsdir/$maxRows_rsdir)-1;
?>
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">
<title>&#26080;&#26631;&#39064;&#25991;&#26723;</title>
</head>

<body>
<?php do { ?>
<a href=\"detail.php?id=<?php echo $row_rsdir[\'id\']; ?>\"><?php echo $row_rsdir[\'name\']; ?></a>
<?php } while ($row_rsdir = mysql_fetch_assoc($rsdir)); ?>
</body>
</html>
<?php
mysql_free_result($rsdir);
?>

//detail.php


<?php require_once(\'Connections/conntest.php\'); ?>
<?php
$colname_rsdir = \"1\";
if (isset($_GET[\'id\'])) {
$colname_rsdir = (get_magic_quotes_gpc()) ? $_GET[\'id\'] : addslashes($_GET[\'id\']);
}
mysql_select_db($database_conntest, $conntest);
$query_rsdir = sprintf(\"SELECT * FROM usrinfo WHERE id = %s\", $colname_rsdir);
$rsdir = mysql_query($query_rsdir, $conntest) or die(mysql_error());
$row_rsdir = mysql_fetch_assoc($rsdir);
$totalRows_rsdir = mysql_num_rows($rsdir);
?>
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">
<title>&#26080;&#26631;&#39064;&#25991;&#26723;</title>
</head>

<body>
<p><?php echo $row_rsdir[\'age\']; ?>
</p>
<p><a href=\"index.php\">back</a></p>
</body>
</html>
<?php
mysql_free_result($rsdir);
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users