Use Php+mysql a Business card library program _php
Source: Internet
Author: User
Keywords program business card one SHOWLIMITCLASSTD
With Php+mysql a business card library program, there are classification search, paging function.
First step: Make a static page by following the representative.
Step Two: Build the library as follows.
ID int (4) No auto_increment
HTTP varchar (25) No
Name varchar (50) No
Email varchar (50) No
GS varchar (200) No
Address varchar (200) No
YB varchar (20) No
ZW varchar (100) No
Tel varchar (20) No
Fax varchar (20) No
bp varchar (20) No
Step three: Find the execution program
if (!isset ($show)) $show = 0;
{
if ($query 1== "Find")
{
$db =mysql_connect ("localhost", "username", "password");
$dbname =mysql_select_db ("Library file name", $db);
mysql_query (' SELECT * from table filename ', $db);
$limit = 2; A page shows a few things.
Global $query, $queryyy, $quer;
Switch ($inout)
{
Case "N":
Find by name
$query = "SELECT * from card where name like '% $keyword% '";
$queryyy = "SELECT * from card where name as '% $keyword% ' ORDER BY id desc limit $show, $limit";
Break
Case "C":
Find by Region
$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":
Find by Job title
$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
}
$result 1=mysql_query ($query);
$total =mysql_num_rows ($result 1); Total number of records that meet the criteria
"; Show Previous Page if ($show-$limit >= 0) { Print "Previous page"; } Print "
"; Show Next Page if (($show + $limit) < $total) { Print "Next page"; } Print "
"; Show All messages Print "All business cards"; Print "
";
Print " ";
?>
If there is a problem, please mailto:lyjrich@sina.com, this program has a problem if you want to show all the cards, I have not implemented this program, if you know how to display all the business card in this program, I hope to send mail to me.
"The copyright of this article is owned by the author and house Orso near net, if need to reprint, please specify the author and source"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.