Jump to content

Archived

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

bigholy

Implement "Go to Detail Page" on DreamweaverMX

Recommended Posts

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>无标题文档</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>无标题文档</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);

?>

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.