Jump to content

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

?>

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.