<? phpclass BaseLogic extends MyDB { protected $tabName; protected $fieldList; protected $messList; function add($postList) { $fieldList=''; $value=''; foreach ($postList as $k=>$v) { if(in_array($k, $this->fieldList)){ $fieldList.=$k.","; if (!get_magic_quotes_gpc()) $value .= "'".addslashes($v)."',"; else $value .= "'".$v."',"; } } $fieldList=rtrim($fieldList, ","); $value=rtrim($value, ","); $sql = "INSERT INTO {$this->tabName} (".$fieldList.") VALUES(".$value.")"; echo $sql; $result=$this->mysqli->query($sql); if($result && $this->mysqli->affected_rows >0 ) return $this->mysqli->insert_id; else return false; }
This is a PHP class for data processing. Friends who need it can download it and use it.
The name of the table and the set of fields, which have the following functions:
Function: add($postList)
Function: Add
Parameters: $postList Submitted variables List
Returns: The newly inserted auto-increment ID
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
07Jul2023
Go language is suitable for processing data. The reasons are: 1. Go language has efficient concurrent processing capabilities, and go language can efficiently perform concurrent operations when processing large amounts of input data; 2. Go language has rich data processing libraries and tools, and Go language provides standard libraries. The encoding/json package can easily encode and decode JSON data; 3. The Go language also has powerful memory management capabilities. Excellent memory management can effectively reduce memory occupation and release, and avoid memory leaks and memory overflows. And other issues.
22May2018
This article mainly introduces PHP's simple method of processing XML data, and analyzes PHP's simple loading, reading, output and other operating techniques for XML format data based on specific examples. Friends who need it can refer to it.
18Feb2024
With the increasing amount of data and the increasingly widespread application of data analysis in various fields, data analysis has become an indispensable part of modern society. In the field of data science, the Python language has become one of the preferred tools for data analysts and scientists with its simple and easy-to-learn features, rich libraries and tools, and powerful data processing and visualization functions. This article will explore how to use Python for data analysis and visualization. 1. Introduction to Python data analysis tools and libraries Python has many advantages
17Jul2023
Summary of image blurring methods using PHP and OpenCV libraries: Image blurring is commonly used in image enhancement, privacy protection and other application fields. This article describes how to implement image blurring using PHP and the OpenCV library, with code examples. Introduction Image blur processing is a technology widely used in image processing and can be used in image enhancement, privacy protection, image style conversion and other fields. In this article, we will introduce how to implement image blurring using PHP language and OpenCV library. Open
10May2023
With the rapid development of the Internet, image processing has become more and more important. There are various ways to process images. This article will focus on how to use PHP for image processing. PHP is a server-side scripting language originally designed for web development that can easily handle images. In PHP, there are many classes and functions that can be used to process images, such as GD, ImageMagick and other libraries. In this article, we will discuss how to use the GD library for image processing. 1. Installation of GD library GD library is a part of PHP
12Jul2016
URL, form data, IP and other processing classes, url form. URL, form data, IP and other processing classes, url form? php class ev{ public $cookie; public $post; public $ get; public $file; public $url; public $G; private $e; public function __con
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images