Table of Contents
可编辑的表格:jQuery+PHP实现实时编辑表格字段内容" >可编辑的表格:jQuery+PHP实现实时编辑表格字段内容
Home php教程 php手册 PHP+ajax实现可以编辑的单元格点击可以修改

PHP+ajax实现可以编辑的单元格点击可以修改

May 25, 2016 pm 04:55 PM
include select textarea

本文章来给大家介绍一个PHP+ajax实现可以编辑的单元格点击可以修改实例效果代码,有需了解的同学可进入参考。

数据库结构

 代码如下 复制代码

-- phpMyAdmin SQL Dump
-- version 2.11.2-rc1
-- http://www.phprm.com
--
-- 主机: localhost
-- 生成日期: 2010 年 11 月 09 日 05:34
-- 服务器版本: 5.0.41
-- PHP 版本: 5.2.4

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- 数据库: `demo`
--

-- --------------------------------------------------------

--
-- 表的结构 `customer`
--

CREATE TABLE IF NOT EXISTS `customer` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(100) NOT NULL,
  `solutation` varchar(40) NOT NULL,
  `phone` varchar(50) NOT NULL,
  `company` varchar(100) NOT NULL,
  `mobile` varchar(50) NOT NULL,
  `source` varchar(50) NOT NULL,
  `sdate` date NOT NULL,
  `job` varchar(50) NOT NULL,
  `web` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `createtime` datetime NOT NULL,
  `modifiedtime` datetime default NULL,
  `note` varchar(500) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

--
-- 导出表中的数据 `customer`
--

INSERT INTO `customer` (`id`, `username`, `solutation`, `phone`, `company`, `mobile`, `source`, `sdate`, `job`, `web`, `email`, `createtime`, `modifiedtime`, `note`) VALUES
(1, '李小三', '先生', '(513) 378-6268', '常丰集团', '13800138000', '合作伙伴', '2011-11-30', '部门经理', 'www.helloweba.com', 'lrfbeyond@163.com', '2010-11-04 21:11:59', '2010-11-08 09:30:35', '备注信息n');


php代码

 代码如下 复制代码

include_once("connect.php");
$query=mysql_query("select * from customer where id=1");
$rs=mysql_fetch_array($query);
$username=$rs['username'];
$userid=$rs['userid'];
$solutation=$rs['solutation'];
$phone=$rs['phone'];
$company=$rs['company'];
$mobile=$rs['mobile'];
$source=$rs['source'];
$sdate=$rs['sdate'];
$job=$rs['job'];
$web=$rs['web'];
$email=$rs['email'];
$createtime=$rs['createtime'];
$modifiedtime=$rs['modifiedtime'];
$note=$rs['note'];
?>




可编辑的表格:jQuery+PHP实现实时编辑表格字段内容-Helloweba演示平台









可编辑的表格:jQuery+PHP实现实时编辑表格字段内容


提示:点击表格中字段对应的内容即可进行在线编辑。







































客户信息
姓名 办公电话
称谓 手机
公司名称 电子邮箱
潜在客户来源 网站
职位 修改时间



sava.php代码

 代码如下 复制代码

include_once("connect.php");

$field=$_POST['id'];

$val=$_POST['value'];
$val = htmlspecialchars($val, ENT_QUOTES);
if($field=="note"){
 if(strlen($val)>100){
  echo "您输入的字符大于100字了";
  exit;
 }
}
$time=date("Y-m-d H:i:s");
if(empty($val)){
    echo "不能为空";
}else{
 $query=mysql_query("update customer set $field='$val',modifiedtime='$time' where id=1");
 if($query){
    echo $val;
 }else{
    echo "数据出错"; 
 }
}
?>


例下载地址:http://file.phprm.com/download/2013/05/16/3788_72817.rar



本文地址:

转载随意,但请附上文章地址:-)

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

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)

What is the difference between php include and include_once What is the difference between php include and include_once Mar 22, 2023 am 10:38 AM

When we write web pages using PHP, sometimes we need to include code from other PHP files in the current PHP file. At this time, you can use the include or include_once function to implement file inclusion. So, what is the difference between include and include_once?

Asynchronous processing method of Select Channels Go concurrent programming using golang Asynchronous processing method of Select Channels Go concurrent programming using golang Sep 28, 2023 pm 05:27 PM

Asynchronous processing method of SelectChannelsGo concurrent programming using golang Introduction: Concurrent programming is an important area in modern software development, which can effectively improve the performance and responsiveness of applications. In the Go language, concurrent programming can be implemented simply and efficiently using Channels and Select statements. This article will introduce how to use golang for asynchronous processing methods of SelectChannelsGo concurrent programming, and provide specific

How to hide the select element in jquery How to hide the select element in jquery Aug 15, 2023 pm 01:56 PM

How to hide the select element in jquery: 1. hide() method, introduce the jQuery library into the HTML page, you can use different selectors to hide the select element, the ID selector replaces the selectId with the ID of the select element you actually use; 2. css() method, use the ID selector to select the select element that needs to be hidden, use the css() method to set the display attribute to none, and replace selectId with the ID of the select element.

How to implement change event binding of select elements in jQuery How to implement change event binding of select elements in jQuery Feb 23, 2024 pm 01:12 PM

jQuery is a popular JavaScript library that can be used to simplify DOM manipulation, event handling, animation effects, etc. In web development, we often encounter situations where we need to change event binding on select elements. This article will introduce how to use jQuery to bind select element change events, and provide specific code examples. First, we need to create a dropdown menu with options using labels:

What is the reason why Linux uses select? What is the reason why Linux uses select? May 19, 2023 pm 03:07 PM

Because select allows developers to wait for multiple file buffers at the same time, it can reduce IO waiting time and improve the IO efficiency of the process. The select() function is an IO multiplexing function that allows the program to monitor multiple file descriptors and wait for one or more of the monitored file descriptors to become "ready"; the so-called "ready" state is Refers to: the file descriptor is no longer blocked and can be used for certain types of IO operations, including readable, writable, and exceptions. select is a computer function located in the header file #include. This function is used to monitor file descriptor changes—reading, writing, or exceptions. 1. Introduction to the select function. The select function is an IO multiplexing function.

How to set textarea read-only How to set textarea read-only Sep 28, 2023 am 11:17 AM

You can use the readonly attribute, disabled and readwrite attributes to set the textarea read-only. Detailed introduction: 1. readonly attribute, the value of the readonly attribute is readonly; 2. disabled attribute, the content of the <textarea> element cannot be changed, because the value of the disabled attribute is disabled; 3. readwrite attribute, the content of the <textarea> element can Changes and more.

How to use the select syntax of mysql How to use the select syntax of mysql Jun 01, 2023 pm 07:37 PM

1. Keywords in SQL statements are not case-sensitive. SELECT is equivalent to SELECT, and FROM is equivalent to from. 2. To select all columns from the users table, you can use the symbol * to replace the column name. Syntax--this is a comment--query out [all] data from the [table] specified by FEOM. * means [all columns] SELECT*FROM--query out the specified data from the specified [table] from FROM Data of column name (field) SELECT column name FROM table name instance--Note: Use English commas to separate multiple columns selectusername, passwordfrom

Implement Select Channels Go concurrent programming performance optimization through golang Implement Select Channels Go concurrent programming performance optimization through golang Sep 27, 2023 pm 01:09 PM

Implementing SelectChannels through golang Performance optimization of Go concurrent programming In the Go language, it is very common to use goroutine and channel to implement concurrent programming. When dealing with multiple channels, we usually use select statements for multiplexing. However, in the case of large-scale concurrency, using select statements may cause performance degradation. In this article, we will introduce some implementations of select through golang

See all articles