<?php  
require_once("db.class.php"); 
$sql=new MS_CODE(); 
$sql->dbhost='localhost'; 
$sql->dbuser='root'; 
$sql->dbpass='root'; 
$sql->dbname='testbase'; 
 
 
 
 
 
 
//insert example 
 
$for_insert=array( 
    'FIELD_FIRST_NAME'=>'your first name', 
    'FIELD_SECOND_NAME'=>'your second name', 
    'FIELD_AGE'=>55 
); 
 
 
if($sql->ms_insert('users',$for_insert)){ 
    echo 'insert OK'; 
} 
else{ 
    echo 'FAILED'; 
} 
 
 
 
//delete example 
 
$sql->ms_delete('users',array('FIELD_FIRST_NAME'=>'john','FIELD_SECOND_NAME'=>'smith')); 
 
 
 
 
//update example 
 
$sql->ms_update('users',array('FIELD_FIRST_NAME'=>'Updated first name!'),array('user_id'=>'55')); 
 
 
 
 
 
//select example 
 
$results=$sql->ms_select("SELECT * FROM users"); //without caching 
$results=$sql->ms_select("SELECT * FROM users", true); //with caching 
 
while($row = mysql_fetch_object($results)){ 
      echo $row->FIELD_FIRST_NAME.' '.$row->FIELD_SECOND_NAME; 
      echo "<br />"; 
    } 
 
 
 
 
//custom sql 
 
$m->ms_sql("SELECT * FROM users LIMIT ".@(int)$_GET['mspagestart'].",10"); 
 
 
 
 
 
//example paging 
 
$config = array( 
'sql'=>'SELECT * FROM users', //SQL query 
'num_link'=>'style="color:#000000; border:1px solid #cccccc; padding:5px 10px 5px 10px;"',  
'num_active'=>'style="background-color:#990000; color:#CCCCCC;  border:1px solid #cccccc; padding:5px 10px 5px 10px; text-decoration:none;"',  
'limit'=>10,  
'max_num_render'=>8,  
'inner_previous'=>'<span>«</span>',  
'inner_next'=>'<span>»</span>',  
'inner_first'=>'<span>««</span>',  
'inner_last'=>'<span>»»</span>',  
'other_gets'=>'' //other $_GET[] parameters ex. '&city='.$_GET['city'].'&country='.$_GET['country'] 
); 
$sql->ms_paging($config); //this will render the paging here 
 
 
 
 
 
//HAPPY USING! 
 
 
?>
 
 |