用php+mysql一个名片库程序_php基础
用php+mysql一个名片库程序,有分类查找,分页功能。
第一步:按下列代表先做个静态页面。
第二步:如下建库。
id int(4) 否 auto_increment
http varchar(25) 否
name varchar(50) 否
email varchar(50) 否
gs varchar(200) 否
address varchar(200) 否
yb varchar(20) 否
zw varchar(100) 否
tel varchar(20) 否
fax varchar(20) 否
bp varchar(20) 否
第三步:查找执行程序
if (!isset($show)) $show=0;
{
if($query1=="查找")
{
$db=mysql_connect("localhost","用户名","密码");
$dbname=mysql_select_db("库文件名",$db);
mysql_query('select * from 表文件名',$db);
$limit=2; //一页显示几条内容。
//global $query,$queryyy,$quer;
switch($inout)
{
case "N":
//按姓名查找
$query="select * from card where name like '%$keyword%'";
$queryyy = "select * from card where name like '%$keyword%' order by id desc limit $show, $limit";
break;
case "C":
//按地区查找
$query="select * from card where address like '%$keyword%' order by id desc";
$queryyy = "select * from card where address like '%$keyword%' order by id desc limit $show, $limit";
break;
case "A":
// 按职务查找
$query="select * from card where zw like '%$keyword%' order by id desc";
$queryyy = "select * from card where zw like '%$keyword%' order by id desc limit $show, $limit";
break;
}
$result1=mysql_query($query);
$total=mysql_num_rows($result1); //总的符合条件的记录数
$quer=mysql_query($queryyy,$db);
$pages=ceil($total/$limit);
}
}
?>
你查找的关键字是:: echo $keyword;?>
echo "
查找名片如下: 共有["; echo $total; echo "]张名片 | 共分["; echo $pages; echo "]页 |
while ($row = mysql_fetch_array($quer))
{
echo "
|
";
}
$vor = $show + $limit;
$back = $show - $limit;
print "
print "
"; for ($i=1;$i{ $new_offset=$limit*($i-1); $parameter="query1=$query1&keyword=$keyword&inout=$inout"; print " $i$nbsp"; } print " |
"; //显示上一页 if ($show - $limit >= 0) { print " 上一页"; } print " |
"; //显示下一页 if (($show + $limit) { print "下一页 "; } print " |
"; //显示全部留言 //print "全部名片 "; print " |
print "
?>
若有问题请mailto:lyjrich@sina.com,这个程序有个问题如果要显示全部名片的话,我这个程序还没有实现此功能,如果你知道在这个程序里怎样显示全部名片的话希望能发mail给我。
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov
