在et上分页的php设计(php分页)
[
2007/12/29 04:18 | by Else ]
2007/12/29 04:18 | by Else ]
//处理分页
$page=1; //起始的记录
$pagelist=2; //每页显示的记录
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$sqlstr = "select * from cuku_products order by id desc "; //所有的记录
//算总的记录
if (isset($_GET['total'])) {
$total = $_GET['total'];
} else {
$all_rs = $db->query($sqlstr);
$total= $db->num_rows($all_rs); //总得记录
}
$page=1; //起始的记录
$pagelist=2; //每页显示的记录
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$sqlstr = "select * from cuku_products order by id desc "; //所有的记录
//算总的记录
if (isset($_GET['total'])) {
$total = $_GET['total'];
} else {
$all_rs = $db->query($sqlstr);
$total= $db->num_rows($all_rs); //总得记录
}
C#连接Access成功
[
2007/12/24 00:48 | by Else ]
2007/12/24 00:48 | by Else ]
C#链access 之前一直用链接sqlserver的函数做程序,一直出错,现在可以了
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace test.src.util
{
public class DbConnction
{
public DbConnction()
{
//
}
static void Main(string[] args)
{
String connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
connectionString += @"d:\data.mdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);
myConnection.Open(); //打开数据库链接
OleDbCommand myCommand = myConnection.CreateCommand(); //定义SqlCommand变量
myCommand.CommandText = "select * from ruby"; //设置SQL语句
OleDbDataReader myDataReader = myCommand.ExecuteReader(); // 从数据库获职数据
//读取DataReader中的数据并输出
while (myDataReader.Read())
{
Console.WriteLine("\t{0}\t{1}", myDataReader["id"], myDataReader["title"]);
}
myDataReader.Close(); //关闭SqlDataReader
myConnection.Close(); //关闭链接
Console.WriteLine("这个是一个链接的测试");
}
}
}
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace test.src.util
{
public class DbConnction
{
public DbConnction()
{
//
}
static void Main(string[] args)
{
String connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
connectionString += @"d:\data.mdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);
myConnection.Open(); //打开数据库链接
OleDbCommand myCommand = myConnection.CreateCommand(); //定义SqlCommand变量
myCommand.CommandText = "select * from ruby"; //设置SQL语句
OleDbDataReader myDataReader = myCommand.ExecuteReader(); // 从数据库获职数据
//读取DataReader中的数据并输出
while (myDataReader.Read())
{
Console.WriteLine("\t{0}\t{1}", myDataReader["id"], myDataReader["title"]);
}
myDataReader.Close(); //关闭SqlDataReader
myConnection.Close(); //关闭链接
Console.WriteLine("这个是一个链接的测试");
}
}
}
$insertGoTo = "admin.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
using System;
using System.Collections.Generic;
using System.Text;
public class Test2
{
public void aaB(string a, int b)
{
if(a!=null)
{
Console.WriteLine("The stirng is " + a + ", the number is " + b);
}
else
{
Console.WriteLine("error");
}
}
public void checkType(object type)
{
Console.WriteLine("The "+type+" type is {0},", type.GetType());
}
public static void Main()
{
Test2 ts = new Test2();
string a="my name is a";
int b=3662296;
ts.aaB(a,b);
int i = 5;
string k="哈,今天的天氣不錯,我叫string ";
Console.WriteLine("i is an int ? {0}" , i.GetType() == typeof(int));
Console.WriteLine("i is an int ? {0}" , typeof(int).IsInstanceOfType(i));
Console.WriteLine("k is an int ? {0}" , typeof(int).IsInstanceOfType(k));
Console.WriteLine("The type of k is {0},",k.GetType());
ts.checkType(k);
ts.checkType(i);
}
}
using System.Collections.Generic;
using System.Text;
public class Test2
{
public void aaB(string a, int b)
{
if(a!=null)
{
Console.WriteLine("The stirng is " + a + ", the number is " + b);
}
else
{
Console.WriteLine("error");
}
}
public void checkType(object type)
{
Console.WriteLine("The "+type+" type is {0},", type.GetType());
}
public static void Main()
{
Test2 ts = new Test2();
string a="my name is a";
int b=3662296;
ts.aaB(a,b);
int i = 5;
string k="哈,今天的天氣不錯,我叫string ";
Console.WriteLine("i is an int ? {0}" , i.GetType() == typeof(int));
Console.WriteLine("i is an int ? {0}" , typeof(int).IsInstanceOfType(i));
Console.WriteLine("k is an int ? {0}" , typeof(int).IsInstanceOfType(k));
Console.WriteLine("The type of k is {0},",k.GetType());
ts.checkType(k);
ts.checkType(i);
}
}
原来可以这么简单,只是没有动手,关于et的多级分类显示
[
2007/12/18 02:50 | by Else ]
2007/12/18 02:50 | by Else ]
简单的就这么点,无限分类的,还要等待
<select name="catid" id="catid">
<!--$list as $rs-->
<optgroup label="{rs['classname']}" title="{rs['content']}">
<!-- <option value="{rs['id']}">{rs['classname']}</option>-->
<!-- $rs['a'] AS $rs -->
<option value="{rs['id']}">{rs['classname']}</option>
<!-- end-->
<!-- end-->
</select>
<!--$list as $rs-->
<optgroup label="{rs['classname']}" title="{rs['content']}">
<!-- <option value="{rs['id']}">{rs['classname']}</option>-->
<!-- $rs['a'] AS $rs -->
<option value="{rs['id']}">{rs['classname']}</option>
<!-- end-->
<!-- end-->
</select>
把雙精度轉換成帶有逗號的數
[
2007/12/13 16:20 | by Else ]
2007/12/13 16:20 | by Else ]
/// <summary>
/// 把雙精度轉換成帶有逗號的數
/// sahu@qq.com
/// </summary>
/// <param name="kstr"></param>
/// <returns></returns>
public string getDublicToStr(double dbstr)
{
string a = dbstr.ToString();
string[] b = a.Split('.');
string f = dbstr.ToString("#,##0")+"."+b[1]; //保證小數點後面相同
return f;
}
/// 把雙精度轉換成帶有逗號的數
/// sahu@qq.com
/// </summary>
/// <param name="kstr"></param>
/// <returns></returns>
public string getDublicToStr(double dbstr)
{
string a = dbstr.ToString();
string[] b = a.Split('.');
string f = dbstr.ToString("#,##0")+"."+b[1]; //保證小數點後面相同
return f;
}
DateTime.ToString()用法详解
[
2007/12/11 17:58 | by Else ]
2007/12/11 17:58 | by Else ]
我们经常会遇到对时间进行转换,达到不同的显示效果,默认格式为:2006-6-6 14:33:34
如果要换成成200606,06-2006,2006-6-6或更多的格式该怎么办呢?
这里将要用到:DateTime.ToString的方法(String, IFormatProvider)
示例:
using System;
using System.Globalization;
String format="D";
DateTime date=DataTime.Now;
Response.Write(date.ToString(format, DateTimeFormatInfo.InvariantInfo));
结果输出
Thursday, June 16, 2006
js版
jq版
<script language="javascript" type="text/javascript">
function show(id){
try{
var n = id;
for(i=1;i<6;i++)
{
document.getElementById('shop'+i).style.display='none';
}
document.getElementById('shop'+n).style.display='block';
}catch(e){}
}
</script>
function show(id){
try{
var n = id;
for(i=1;i<6;i++)
{
document.getElementById('shop'+i).style.display='none';
}
document.getElementById('shop'+n).style.display='block';
}catch(e){}
}
</script>
jq版
function showdNews(n,oobj)
{
show=oobj+n;
for(i=1;i<5;i++){
$('#'+oobj+i).hide();
}
$('#'+show).show();
}
{
show=oobj+n;
for(i=1;i<5;i++){
$('#'+oobj+i).hide();
}
$('#'+show).show();
}














