public function Insert($params) { //prepair function varaibles $table = isset($params['table']) ? $params['table'] : false; $insertItems = isset($params['insert_items']) ? $params['insert_items'] : false; $execute = isset($params['execute']) ? $params['execute'] : true; $print = isset($params['print']) ? $params['print'] : false; //Preform Insert on table if (!empty($insertItems)) { //create sql from items provided $insert = $this->buildInsert($table, $insertItems); //print sql if ($print) { SERVER::dump($insert['statement']); } //execute sql if ($execute == true) { //connect if not already $this->Connect(); //prepair assembled statement $theStatement = $this->connection->prepare($insert['statement']); //Dynamicly Bind assembled params to statement call_user_func_array(array($theStatement, 'bind_param'), $insert['bindParams']); //execute statement $sucess = $theStatement->execute(); //return sucess state $theStatement->close(); return $sucess; } } }
function SHOW_PRETTY($result) { $pretty = SERVER::json_pretty($result); //convert structure or json SERVER::dump($pretty, 'JSON'); //dump string to the screen }
InsertUpdateOrDeleteRow ($params=array(), $UniqueField=null, &$debug=false) ---------------------------------------------------------------------------- SERVER::dump($var); will display the contents of the variable: array/object or otherwise */ require_once 'lib/db1.class.php'; $DB = new DB1($DBc); $DB->OpenConnection(); //accociative select all ------------------------------------------------ $fetchParams = array('table' => 'users2', 'select_items' => '*', 'row_key' => 'id'); SERVER::dump($fetchParams); //display params $result = $DB->FetchRow($fetchParams); $result = json_encode($result, JSON_PRETTY_PRINT); SERVER::dump($result); //display results SERVER::dump($result); //display results //============================================================== //example fo some capabilities $fetchParams = array('table' => 'users2', 'select_items' => array('username', 'id'), 'order' => 'desc', 'by' => 'id', 'row_key' => 'id', 'limit' => 5, 'where_items' => array('deleted' => 0, 'blocked' => 1)); $result = $DB->FetchRow($fetchParams); //SERVER::dump($result); //============================================================== // experiment using "magic methods" //users2 is the table name... you can see where this can go... $result = $DB->users2->FetchAll(); //SERVER::dump($result); $DB->CloseConnection(); //CLOSE DATABASE //////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
SERVER::dump($data); foreach($data as $rid => $row){ $colCount = 0; $colEmpty = 0; foreach($row as $cid => $col){ $colCount++; if(empty($col)){ $colEmpty++; } if($colEmpty == $colCount){ break; } } } if(0==1){ $fileurl = $jsonDecode['result']['resources'][0]['url']; $CSV = file_get_contents($fileurl); //fetch file contents if(strlen($CSV) > 0){ $Data = CSVStrToArray($CSV); } SERVER::dump($Data); } ?>
fso.WriteLine(var); fso.WriteLine("\\n"); } </script>'; print '<iframe name="myFrame"></iframe>'; $count = 0; foreach ($man as $row) { $url = $row['img']; //print '<hr>'; //print $i; $urlEncoded = urlencode($url); $addTolistScript = 'addToList.php?LIST=cars&url=' . $urlEncoded . '&model=' . $row['model'] . '&maker=' . $row['maker'] . '&year=' . $row['year']; print '<a href="' . $addTolistScript . '" target="myFrame"><img src="' . $url . '" style="float:left"></a>'; $count++; } SERVER::dump($arr); //================================== print '<hr>'; $fetchParams = array('table' => 'records', 'select_items' => array('year', 'maker', 'model')); $fetch = $DB->FetchRow($fetchParams); $A = array(); foreach ($fetch as $row) { $year = $row['year']; $model = $row['model']; $make = $row['maker']; $A[$year][$make][$model] = 1; } //SERVER::dump($A); //$A[$year][$make][$model]; //-------------------------Car Years--------------------------- $HTML = '<form action="" method="post">';
<?php require_once 'lib/server.class.php'; // <--- check out the goodies in there :) ini_set('memory_limit', '640M'); SERVER::dump($_GET); $list = isset($_GET['LIST']) ? $_GET['LIST'] : 'dump'; if (isset($_GET['LIST'])) { unset($_GET['LIST']); SERVER::dump($_GET); $JSON = json_encode($_GET) . "\n"; SERVER::dump($JSON); file_put_contents('LIST_' . $list . '_collection.txt', $JSON, FILE_APPEND); }
if (in_array(gettype($JSON), array('array', 'object'))) { $JSON = (array) $JSON; foreach ($JSON as $key => $value) { $JSON[$key] = json_toarray($value); } } return $JSON; } $groupName = 'PixelsDaily'; $url = 'http://graph.facebook.com/' . $groupName . '/photos?fields=picture,source,name&type=uploaded'; $pages = !empty($_GET['pages']) ? $_GET['pages'] : 5; SERVER::dump($groupName); SERVER::dump($url); SERVER::dump($pages, '_GET[\'pages\']'); //--------------------------------- $count = 0; $i = 0; do { //get pages $JSON = getJSON($url); $url = $JSON['paging']['next']; $count += $JSON['count']; $i++; } while ($i < $pages); //--------------------------------- //NAVIGATION $keys = array_keys($JSON); SERVER::dump($count); SERVER::dump($keys); SERVER::dump($JSON['paging']);
//example fo some capabilities $fetchParams = array('table' => 'records', 'select_items' => 'maker', 'row_key' => 'maker', 'flat_result' => true); $man = $DB->FetchRow($fetchParams); //$result = $DB->CountRow($fetchParams); //SERVER::dump($result); $i = 1; $fetchThis = array('table' => 'records', 'select_items' => array('year', 'maker', 'model', 'cartype'), 'limit' => 100); $all = $DB->FetchRow($fetchThis); $working = array(); $url = array(); $num = 0; foreach ($all as $i) { $theMaker = trim($all[$num][maker]); $theYear = trim($all[$num][year]); $theType = trim($all[$num][cartype]); $theModel = trim($all[$num][model]); $URL = 'http://www.edmunds.com/' . $theMaker . '/' . $theModel . '/' . $theYear; $URL = str_replace(' ', '-', $URL); $url[] = $URL; //--------------------------------- $fetched = file_get_contents($URL); SERVER::dump(strlen($fetched)); $num++; } //.'/?sub='.$theType //SERVER::dump($url); //* foreach ($url as $x) { } SERVER::dump($x); //*/