search
Homephp教程php手册坏狼php学习 计数器实例代码

坏狼php学习 计数器实例代码

Jun 13, 2016 pm 12:28 PM
doctypephpcodeWritecopystudyExampleEstablishdatabasedocumentstepcounterread

然后建立文件如下,第1步骤连数据库,然后写,然后读.

复制代码 代码如下:


nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
  $mysql_server_name = "localhost"; 
  $mysql_username    = "root"; 
  $mysql_password    = ""; 
  $mysql_database    = "db"; 
  //抓ip 
  $ip = getenv ("REMOTE_ADDR"); 
  //建立连线--透过(伺服务器位置,使用者名称,使用者密码) 
  $conn = mysql_connect($mysql_server_name,$mysql_username,$mysql_password); 
  //准备好 sql语法   此语法为新增资料 
  $sql = "INSERT INTO `num` ( `name` ,`ip`, `new` ) VALUES ('badwolf','$ip','1');"; 
  //选取你想要处理的资料库 
  mysql_select_db($mysql_database,$conn); 
  //进行查询 
  $result = mysql_query($sql); 
  //结果并且释放连线 
  mysql_close($conn); 
  //------------------------------------------------------------------ 
  //以下为印出资料 

  //建立连线   透过(伺服务器位置,使用者名称,使用者密码) 
  $conn = mysql_connect($mysql_server_name,$mysql_username,$mysql_password); 
  //准备好 sql语法   此语法为读取资料  
  $sql = "SELECT COUNT(*) FROM `num` WHERE name='badwolf' "; 
  //进行查询 
  $result = mysql_db_query($mysql_database,$sql,$conn); 
  //将查询后的结果 抓出 
  $row = mysql_fetch_row($result); 
  //印出该资料的所有栏位 
  //print_r($row); 
  //清除查询后的结果 
  mysql_free_result($result); 
?> 
 

 
 
坏狼安全网php计数器 
 
 

 
  
 
    

坏狼安全网php计数器

 
    

开站至今已经有=$row[0]; ?>人次

 
  
 
 

 
Statement
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

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.