Home Backend Development PHP Tutorial A business card library program using php+mysql_PHP tutorial

A business card library program using php+mysql_PHP tutorial

Jul 21, 2016 pm 04:01 PM
php+mysql Classification Pagination Function business card Library have Find use program

Use php+mysql to create a business card library program with classification search and paging functions.

Step 1: Make a static page first according to the following representation.


          
              
              
            
              
              
            
          
  
                
                    
                    
                  
                    
                    
                    
                    
                  
                
输入关键字:

                    
  
                      
                      按姓名
  
                      
                      按地区
  
                      
                      按职位

              
  
                
                
              

        

第二步:如下建库。
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 "
  
    
    
  

      
查找名片如下: 共有[";
      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<=$pages;$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) < $total)
{
print "下一页 ";
}
print "
";
//Show all comments
//print "All business cards ";
print "
";
print "
";
?>
If you have any questions, please mailto:lyjrich@sina.com. There is a problem with this program. If you want to display all business cards, my program has not implemented this function. If you know how to display it in this program, If you have all the business cards, I hope you can send them to me via email.

[The copyright of this article is jointly owned by the author and Oso.com. If you need to reprint, please indicate the author and source]

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316731.htmlTechArticleA business card library program using php+mysql, with classification search and paging functions. Step 1: Make a static page first according to the following representation. form method=post action=find1.php name=card onSubmit=return...
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)

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

The difference between vivox100s and x100: performance comparison and function analysis The difference between vivox100s and x100: performance comparison and function analysis Mar 23, 2024 pm 10:27 PM

Both vivox100s and x100 mobile phones are representative models in vivo's mobile phone product line. They respectively represent vivo's high-end technology level in different time periods. Therefore, the two mobile phones have certain differences in design, performance and functions. This article will conduct a detailed comparison between these two mobile phones in terms of performance comparison and function analysis to help consumers better choose the mobile phone that suits them. First, let’s look at the performance comparison between vivox100s and x100. vivox100s is equipped with the latest

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

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

What exactly is self-media? What are its main features and functions? What exactly is self-media? What are its main features and functions? Mar 21, 2024 pm 08:21 PM

With the rapid development of the Internet, the concept of self-media has become deeply rooted in people's hearts. So, what exactly is self-media? What are its main features and functions? Next, we will explore these issues one by one. 1. What exactly is self-media? We-media, as the name suggests, means you are the media. It refers to an information carrier through which individuals or teams can independently create, edit, publish and disseminate content through the Internet platform. Different from traditional media, such as newspapers, television, radio, etc., self-media is more interactive and personalized, allowing everyone to become a producer and disseminator of information. 2. What are the main features and functions of self-media? 1. Low threshold: The rise of self-media has lowered the threshold for entering the media industry. Cumbersome equipment and professional teams are no longer needed.

What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? Mar 21, 2024 pm 04:16 PM

As Xiaohongshu becomes popular among young people, more and more people are beginning to use this platform to share various aspects of their experiences and life insights. How to effectively manage multiple Xiaohongshu accounts has become a key issue. In this article, we will discuss some of the features of Xiaohongshu account management software and explore how to better manage your Xiaohongshu account. As social media grows, many people find themselves needing to manage multiple social accounts. This is also a challenge for Xiaohongshu users. Some Xiaohongshu account management software can help users manage multiple accounts more easily, including automatic content publishing, scheduled publishing, data analysis and other functions. Through these tools, users can manage their accounts more efficiently and increase their account exposure and attention. In addition, Xiaohongshu account management software has

PHP Tips: Quickly Implement Return to Previous Page Function PHP Tips: Quickly Implement Return to Previous Page Function Mar 09, 2024 am 08:21 AM

PHP Tips: Quickly implement the function of returning to the previous page. In web development, we often encounter the need to implement the function of returning to the previous page. Such operations can improve the user experience and make it easier for users to navigate between web pages. In PHP, we can achieve this function through some simple code. This article will introduce how to quickly implement the function of returning to the previous page and provide specific PHP code examples. In PHP, we can use $_SERVER['HTTP_REFERER'] to get the URL of the previous page

Scripted diagnostics native host has stopped working [FIXED] Scripted diagnostics native host has stopped working [FIXED] Mar 11, 2024 am 09:37 AM

When running a program or troubleshooting, if you get an error message indicating that script diagnostics localhost has stopped working, this could be due to a number of reasons. Fixing this issue on a Windows 11/10 PC may require a different approach, as each computer's situation may be different. One common reason is that the script itself is buggy or corrupted, preventing it from running properly. Solutions to this problem may include repairing or reinstalling the script, or trying a different version of the script. Another possible cause is corrupted or missing system files, which may affect the script's operation. In this case, you can try running a system file check tool to repair any damaged files, or perform a system recovery to restore to the previous

See all articles