Home Backend Development PHP Tutorial 用php mysql一个名片库程序_PHP

用php mysql一个名片库程序_PHP

Jun 01, 2016 pm 12:29 PM
class limit business card program

用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 "
















$row[gs]


$row[name] $row[zw]







  • 电话:$row[tel]

  • 传真:$row[fax]

  • 网址:$row[http]

  • 电子信箱:$row[eamil]

  • 地址:$row[address]

  • 邮编:$row[yb]

  • BP:$row[bp]




";


}

$vor = $show $limit;
$back = $show - $limit;
print "
";

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给我。

【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
How to make Google Maps the default map in iPhone How to make Google Maps the default map in iPhone Apr 17, 2024 pm 07:34 PM

The default map on the iPhone is Maps, Apple's proprietary geolocation provider. Although the map is getting better, it doesn't work well outside the United States. It has nothing to offer compared to Google Maps. In this article, we discuss the feasible steps to use Google Maps to become the default map on your iPhone. How to Make Google Maps the Default Map in iPhone Setting Google Maps as the default map app on your phone is easier than you think. Follow the steps below – Prerequisite steps – You must have Gmail installed on your phone. Step 1 – Open the AppStore. Step 2 – Search for “Gmail”. Step 3 – Click next to Gmail app

How to write a simple countdown program in C++? How to write a simple countdown program in C++? Nov 03, 2023 pm 01:39 PM

C++ is a widely used programming language that is very convenient and practical in writing countdown programs. Countdown program is a common application that can provide us with very precise time calculation and countdown functions. This article will introduce how to use C++ to write a simple countdown program. The key to implementing a countdown program is to use a timer to calculate the passage of time. In C++, we can use the functions in the time.h header file to implement the timer function. The following is the code for a simple countdown program

Clock app missing in iPhone: How to fix it Clock app missing in iPhone: How to fix it May 03, 2024 pm 09:19 PM

Is the clock app missing from your phone? The date and time will still appear on your iPhone's status bar. However, without the Clock app, you won’t be able to use world clock, stopwatch, alarm clock, and many other features. Therefore, fixing missing clock app should be at the top of your to-do list. These solutions can help you resolve this issue. Fix 1 – Place the Clock App If you mistakenly removed the Clock app from your home screen, you can put the Clock app back in its place. Step 1 – Unlock your iPhone and start swiping to the left until you reach the App Library page. Step 2 – Next, search for “clock” in the search box. Step 3 – When you see “Clock” below in the search results, press and hold it and

How to open a website using Task Scheduler How to open a website using Task Scheduler Oct 02, 2023 pm 11:13 PM

Do you frequently visit the same website at about the same time every day? This can lead to spending a lot of time with multiple browser tabs open and cluttering the browser while performing daily tasks. Well, how about opening it without having to launch the browser manually? It's very simple and doesn't require you to download any third-party apps, as shown below. How do I set up Task Scheduler to open a website? Press the key, type Task Scheduler in the search box, and then click Open. Windows On the right sidebar, click on the Create Basic Task option. In the Name field, enter the name of the website you want to open and click Next. Next, under Triggers, click Time Frequency and click Next. Select how long you want the event to repeat and click Next. Select enable

iOS 17: How to organize iMessage apps in Messages iOS 17: How to organize iMessage apps in Messages Sep 18, 2023 pm 05:25 PM

In iOS 17, Apple not only added several new messaging features, but also tweaked the design of the Messages app to give it a cleaner look. All iMessage apps and tools, such as the camera and photo options, can now be accessed by tapping the "+" button above the keyboard and to the left of the text input field. Clicking the "+" button brings up a menu column with a default order of options. Starting from the top, there's camera, photos, stickers, cash (if available), audio, and location. At the very bottom is a "More" button, which when tapped will reveal any other installed messaging apps (you can also swipe up to reveal this hidden list). How to reorganize your iMessage app You can do this below

Can't allow access to camera and microphone in iPhone Can't allow access to camera and microphone in iPhone Apr 23, 2024 am 11:13 AM

Are you getting "Unable to allow access to camera and microphone" when trying to use the app? Typically, you grant camera and microphone permissions to specific people on a need-to-provide basis. However, if you deny permission, the camera and microphone will not work and will display this error message instead. Solving this problem is very basic and you can do it in a minute or two. Fix 1 – Provide Camera, Microphone Permissions You can provide the necessary camera and microphone permissions directly in settings. Step 1 – Go to the Settings tab. Step 2 – Open the Privacy & Security panel. Step 3 – Turn on the “Camera” permission there. Step 4 – Inside, you will find a list of apps that have requested permission for your phone’s camera. Step 5 – Open the “Camera” of the specified app

Identity matrix program in C language Identity matrix program in C language Aug 30, 2023 am 10:45 AM

Given a square matrix M[r][c], where "r" is a certain number of rows and "c" are columns such that r=c, we have to check if "M" is the identity matrix. Identity matrix Identity matrix is ​​also known as identity matrix of size nxn square matrix in which the integer value of diagonal elements is 1 and the integer value of non-diagonal elements is 0 like the example given below-$$I1=\ begin{bmatrix}1\end{bmatrix},\I2=\begin{bmatrix}1&0\0&1\end{bmatrix},\I3=\begin{bmatrix}1&0&0\0&1&0\0&amp

Detailed explanation of how to use take and limit in Laravel Detailed explanation of how to use take and limit in Laravel Mar 10, 2024 pm 05:51 PM

"Detailed explanation of how to use take and limit in Laravel" In Laravel, take and limit are two commonly used methods, used to limit the number of records returned in database queries. Although their functions are similar, there are some subtle differences in specific usage scenarios. This article will analyze the usage of these two methods in detail and provide specific code examples. 1. Take method In Laravel, the take method is used to limit the number of records returned, usually combined with the orderBy method.

See all articles