<?php require_once('Conn/hx98.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
} $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}$maxRows_hx = 10;
$pageNum_hx = 0;
if (isset($_GET['pageNum_hx'])) {
$pageNum_hx = $_GET['pageNum_hx'];
}
$startRow_hx = $pageNum_hx * $maxRows_hx;
mysql_query("set names utf8");
mysql_select_db($database_hx98, $hx98);
$query_hx = "SELECT * FROM content_publish ORDER BY content_id DESC";
$query_limit_hx = sprintf("%s LIMIT %d, %d", $query_hx, $startRow_hx, $maxRows_hx);
$hx = mysql_query($query_limit_hx, $hx98) or die(mysql_error());
$row_hx = mysql_fetch_assoc($hx);if (isset($_GET['totalRows_hx'])) {
$totalRows_hx = $_GET['totalRows_hx'];
} else {
$all_hx = mysql_query($query_hx);
$totalRows_hx = mysql_num_rows($all_hx);
}
$totalPages_hx = ceil($totalRows_hx/$maxRows_hx)-1;
?> <?php do { ?>
<li>
<?php echo $row_hx['content_original_autor']; ?>
</li>
<?php } while ($row_hx = mysql_fetch_assoc($hx)); ?>
我想把数据库中 $row_hx['content_original_autor']; 按 10条一页显示出来,但是去掉重复显示的,也就是说 $row_hx['content_original_autor']; 如果有一样的内容 则不显示。MySQLPHPString函数数据库
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
} $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}$maxRows_hx = 10;
$pageNum_hx = 0;
if (isset($_GET['pageNum_hx'])) {
$pageNum_hx = $_GET['pageNum_hx'];
}
$startRow_hx = $pageNum_hx * $maxRows_hx;
mysql_query("set names utf8");
mysql_select_db($database_hx98, $hx98);
$query_hx = "SELECT * FROM content_publish ORDER BY content_id DESC";
$query_limit_hx = sprintf("%s LIMIT %d, %d", $query_hx, $startRow_hx, $maxRows_hx);
$hx = mysql_query($query_limit_hx, $hx98) or die(mysql_error());
$row_hx = mysql_fetch_assoc($hx);if (isset($_GET['totalRows_hx'])) {
$totalRows_hx = $_GET['totalRows_hx'];
} else {
$all_hx = mysql_query($query_hx);
$totalRows_hx = mysql_num_rows($all_hx);
}
$totalPages_hx = ceil($totalRows_hx/$maxRows_hx)-1;
?> <?php do { ?>
<li>
<?php echo $row_hx['content_original_autor']; ?>
</li>
<?php } while ($row_hx = mysql_fetch_assoc($hx)); ?>
我想把数据库中 $row_hx['content_original_autor']; 按 10条一页显示出来,但是去掉重复显示的,也就是说 $row_hx['content_original_autor']; 如果有一样的内容 则不显示。MySQLPHPString函数数据库
解决方案 »
- 一个字段有多个不同的值,怎么将这些值显示在一起。
- Call to a member function fetch() on a non-object错误
- php如何查询部门名和员工姓名
- PHP导入问题~!总没成功但提示 成功
- MySQL的id号,如何才能变成规定长度的形式?
- 请教用C++往MYSQL中插入中文汉字,全是乱码,将编码方式改为GB2312就会出现运行时错误
- php过滤掉无法识别的问号字符
- Pear Soap 提问
- 各位大侠帮个忙, 如何使用Apache打开本机PHP文档?请在十五分钟内给答案可以吗?送百分
- 请问怎样编查看在线用户的IP来源
- 禁止搜索引擎访问本站一切文件的robots.txt怎么写?
- json问题请教
1.array_unique 去除重复(目的是为了留下值第一次出现的key),然后用 array_diff 对 array_keys 求差集
凡是key在差集内的就不显示
这种方法一般要先把数据形成数组处理2.建一个空数组A,每次显示如果不存在A内则,添加进去,并显示,如果A中已存在该值则跳过
... group by content_original_autor
试试