search
HomePHP LibrariesOther librariesPHP classes for data processing
PHP classes for data processing
<?
 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


Disclaimer

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

URL, form data, IP and other processing classes, url form_PHP tutorialURL, form data, IP and other processing classes, url form_PHP tutorial

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

Implementation method of PHP processing binary data, php processing binary dataImplementation method of PHP processing binary data, php processing binary data

06Jul2016

The implementation method of PHP processing binary data, php processing binary data. Implementation method of PHP processing binary data, PHP processing binary data PHP needs to use pack() and unpack() to process binary data. pack() is used to convert data into binary data. The usage method is as follows:

Which foreach method is better for processing list data in PHP?Which foreach method is better for processing list data in PHP?

06Jul2016

During development, it is often necessary to process the list data taken out from the database. There are three ways to write them, all of which can get the same result. I have always been accustomed to using the first way. Which one is better in terms of readability and performance? List data such as: {code...} Writing method 1, modify the original array...

How Do I Link Static Libraries That Depend on Other Static Libraries?How Do I Link Static Libraries That Depend on Other Static Libraries?

13Dec2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

PHP mathematical operations and data processing example analysis, data processing example analysis_PHP tutorialPHP mathematical operations and data processing example analysis, data processing example analysis_PHP tutorial

12Jul2016

PHP mathematical operations and data processing example analysis, data processing example analysis. PHP mathematical operations and data processing example analysis, data processing example analysis This article describes PHP mathematical operations and data processing methods with examples. Share it with everyone for your reference, the details are as follows: 1.

Implementation method of PHP processing binary data, php processing binary data_PHP tutorialImplementation method of PHP processing binary data, php processing binary data_PHP tutorial

12Jul2016

The implementation method of PHP processing binary data, php processing binary data. Implementation method of PHP processing binary data, PHP processing binary data PHP needs to use pack() and unpack() to process binary data. pack() is used to convert data into binary data. The usage method is as follows:

See all articles