Login   Register  
PHP Classes
elePHPant
Icontem

File: demo_insertData.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Arthur Pissakov  >  Insert or Update Tables  >  demo_insertData.php  >  Download  
File: demo_insertData.php
Role: Example script
Content type: text/plain
Description: demo with explications
Class: Insert or Update Tables
Insert or update MySQL database records
Author: By
Last change:
Date: 7 years ago
Size: 3,733 bytes
 

Contents

Class file image Download
<?php

/**

CHANGE DEFINTION OF CONECTION
IN method of CLASS --  impliqueQwery(){ }

USE YOUR DATA TABLE .

$arrayUpdateData=array (
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value'
);

==================================================================================

$objectInsertNewData=new insertData();

$objectInsertNewData->usingData('nameOfTable',$arrayUpdateData);

==================================================================================

$objectUpdateDataInRowExist=new insertData();

$objectUpdateDataInRowExist->('nameOfTable',$arrayUpdateData,'value Of ColumnXXX in this row','ColumnXXX');

$returnedValue=$objectUpdateDataInRowExist->('nameOfTable',$arrayUpdateData,'value Of ColumnXXX in this row','ColumnXXX','name Of The Column That You Want To Get Value From Same Row');

==================================================================================

UPDATE MORE THAN ONE TABLES UNITING ONE WITH ANOTHER


    id          email        andAnother    
  |        23    |  ura@bk.ru |         456           |            this id = x_id
  -------------------------------------------
  |     24    |sveta@bk.ru |        978            |
  -------------------------------------------
  
  
    id           x_id        andAnother       
  |        2    |   23        |       drink           |            this id = y_id
  -------------------------------------------
  |     3    |    24        |        eat            |
  -------------------------------------------
      
    id          y_id         andAnother       
  |     news   |   2        |          color        |
  -------------------------------------------            this id = z_id
  |    pics |    3        |        sound        |
  -------------------------------------------
  
  
    id         z_id             andAnother
  |       456     |   news    |          black        |
  -------------------------------------------
  |    457     |    pics    |        blue        |
  -------------------------------------------
  
  $arrayFor1_Table=array (
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value'
);

$arrayFor2_Table=array (
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value'
);

$arrayFor3_Table=array (
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value'
);

$arrayFor4_Table=array (
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value',
    'columnName'='value'
);
  
        $arrayAll_Arrays_Together=array (
            $arrayFor1_Table,
            $arrayFor2_Table,
            $arrayFor3_Table,
            $arrayFor4_Table
        );  
  
  
          $array_With_Tables_Names(
            'nameOf1_Table',
            'nameOf2_Table',
            'nameOf3_Table',
            'nameOf4_Table'
          );
  
  
 $objectUpdateDataInRowExist=new insertData();

$objectUpdateDataInRowExist->(
                                $array_With_Tables_Names,
                                $arrayAll_Arrays_Together,
                                'sveta@bk.ru ',
                                'email');
                                
All changed data uniting with 'sveta@bk.ru ',column email from first table.  



==================================================================================


 */

// require_once ("../conStr.php");
require_once ("./class_insertData.php");

$obj=new insertData();

$arr=array( 
    
'id'=>'19',
    
'event_id' => '7' ,
 
'hear_from ' => '222 Hello man',
 
'family_register' => '1');
 
$v=$obj->usingData("_events_user_survey",$arr,"19","id","hear_from");

echo 
' ok - '.$v;

$arrNew=array( 
    
'event_id' => '07' ,
     
'hear_from ' => 'Best Wishes!',
     
'family_register' => '1');
     
$obj->usingData("_events_user_survey",$arrNew);
echo 
'<br> succsesful finish ';
?>