| the ezSQL query produces this ezsql_disk_cache_object on the first db query |
display below comes from processing the cached object |
script reads cache and generates results array based on user clicks |
||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
cached object
Array ( [0] => stdClass Object ( [id] => 7 [category] => Alien [lettername] => G [fname] => Gary [lname] => Gossamar [email] => [address] => 123234 Bighouse Lane Key West, FL 22050 [ph_home] => 999--555-1234 [ph_work] => [ph_cell] => [fax] => [notes] => [url] => [username] => [password] => [dateentered] => 2006-02-03 14:31:40 [fletter] => G ) [1] => stdClass Object ( [id] => 25 [category] => Geek [lettername] => G [fname] => Joey [lname] => Graystone [email] => joey@comcast.net [address] => 123 Silver Street Detroit, MI [ph_home] => [ph_work] => [ph_cell] => 999--555-1234 [fax] => [notes] => Seaman 1st class [url] => http://comcast.net [username] => [password] => [dateentered] => 2010-06-19 10:28:13 [fletter] => G ) [2] => stdClass Object ( [id] => 13 [category] => Alien [lettername] => G [fname] => Mike [lname] => Greenleaf [email] => [address] => 800 35th St Ocean Marathon, FL 33050 [ph_home] => 999--555-1234 [ph_work] => 999--555-1234 [ph_cell] => [fax] => [notes] => Triple threat [url] => [username] => [password] => [dateentered] => 2006-01-06 15:31:33 [fletter] => G ) [3] => stdClass Object ( [id] => 49 [category] => Geek [lettername] => H [fname] => Andy [lname] => Hardy [email] => qwerrty@asdf.net [address] => 123 main St [ph_home] => 123-345-6789 [ph_work] => [ph_cell] => [fax] => [notes] => Some notes go here [url] => http://qwerty.com [username] => [password] => [dateentered] => 2006-02-07 16:55:20 [fletter] => H ) [4] => stdClass Object ( [id] => 51 [category] => Politician [lettername] => H [fname] => Harry [lname] => Houdini [email] => harry@comcast.net [address] => [ph_home] => [ph_work] => [ph_cell] => [fax] => [notes] => [url] => http:// [username] => [password] => [dateentered] => 2010-06-19 10:29:07 [fletter] => H ) [5] => stdClass Object ( [id] => 58 [category] => Alien [lettername] => L [fname] => Tom [lname] => Lastly [email] => tom@tomlastly.com [address] => 1121 Test Place VerryVille, OK [ph_home] => 222-1232 [ph_work] => 222-1245 [ph_cell] => [fax] => 453-2233 [notes] => Near Sighted [url] => http://tomlastly.com [username] => [password] => [dateentered] => 2006-03-23 19:40:06 [fletter] => L ) [6] => stdClass Object ( [id] => 17 [category] => Alien [lettername] => W [fname] => John [lname] => Walker [email] => [address] => Main Street Boston, MA [ph_home] => 999--555-1234 [ph_work] => [ph_cell] => [fax] => [notes] => Sailing Climbing [url] => [username] => [password] => [dateentered] => 2006-01-06 15:29:04 [fletter] => W ) [7] => stdClass Object ( [id] => 53 [category] => Politician [lettername] => W [fname] => Wilko [lname] => Warranski [email] => zelda@symballking.com [address] => 123 Main St Pukipsee PA 991199 [ph_home] => 999-555-1234 [ph_work] => [ph_cell] => [fax] => [notes] => Great on symballs and trumpets [url] => http://symbols.com/ [username] => [password] => [dateentered] => 2006-07-15 16:24:40 [fletter] => W ) ) |
TBS results from "mycontacts" table
Here's a code snippet to show how easy it is to do this stuff <?php //the PHP code to get the 'category' subset from cache object // Lets get the subset based on the returned $_GET parm if( isset($cat) ) { unset($recs); // remember to clear previous vals foreach ($result as $item){ // $result is original the cache object // just items that match this 'cat' if( $item->category==$cat ){ // to get ALL fields from the cache object $recs[] = $item; // To get just SOME specific fields only -build array manually // for TBS to use in the block merge -like this //$recs[] = array("id"=>"$item->id", "fname"=>"$item->fname"); } } } $TBS->MergeBlock('blk', $recs); ?> TBS object syntax examples: 'var.result.0.category' = Alien 'var.result.1.category' = Geek 'var.result.2.category' = Alien 'var.result.0.lname' = Gossamar 'var.result.1.lname' = Graystone 'var.result.2.lname' = Greenleaf |
_GET=
Array ( [0] => stdClass Object ( [id] => 7 [category] => Alien [lettername] => G [fname] => Gary [lname] => Gossamar [email] => [address] => 123234 Bighouse Lane Key West, FL 22050 [ph_home] => 999--555-1234 [ph_work] => [ph_cell] => [fax] => [notes] => [url] => [username] => [password] => [dateentered] => 2006-02-03 14:31:40 [fletter] => G ) [1] => stdClass Object ( [id] => 25 [category] => Geek [lettername] => G [fname] => Joey [lname] => Graystone [email] => joey@comcast.net [address] => 123 Silver Street Detroit, MI [ph_home] => [ph_work] => [ph_cell] => 999--555-1234 [fax] => [notes] => Seaman 1st class [url] => http://comcast.net [username] => [password] => [dateentered] => 2010-06-19 10:28:13 [fletter] => G ) [2] => stdClass Object ( [id] => 13 [category] => Alien [lettername] => G [fname] => Mike [lname] => Greenleaf [email] => [address] => 800 35th St Ocean Marathon, FL 33050 [ph_home] => 999--555-1234 [ph_work] => 999--555-1234 [ph_cell] => [fax] => [notes] => Triple threat [url] => [username] => [password] => [dateentered] => 2006-01-06 15:31:33 [fletter] => G ) [3] => stdClass Object ( [id] => 49 [category] => Geek [lettername] => H [fname] => Andy [lname] => Hardy [email] => qwerrty@asdf.net [address] => 123 main St [ph_home] => 123-345-6789 [ph_work] => [ph_cell] => [fax] => [notes] => Some notes go here [url] => http://qwerty.com [username] => [password] => [dateentered] => 2006-02-07 16:55:20 [fletter] => H ) [4] => stdClass Object ( [id] => 51 [category] => Politician [lettername] => H [fname] => Harry [lname] => Houdini [email] => harry@comcast.net [address] => [ph_home] => [ph_work] => [ph_cell] => [fax] => [notes] => [url] => http:// [username] => [password] => [dateentered] => 2010-06-19 10:29:07 [fletter] => H ) [5] => stdClass Object ( [id] => 58 [category] => Alien [lettername] => L [fname] => Tom [lname] => Lastly [email] => tom@tomlastly.com [address] => 1121 Test Place VerryVille, OK [ph_home] => 222-1232 [ph_work] => 222-1245 [ph_cell] => [fax] => 453-2233 [notes] => Near Sighted [url] => http://tomlastly.com [username] => [password] => [dateentered] => 2006-03-23 19:40:06 [fletter] => L ) [6] => stdClass Object ( [id] => 17 [category] => Alien [lettername] => W [fname] => John [lname] => Walker [email] => [address] => Main Street Boston, MA [ph_home] => 999--555-1234 [ph_work] => [ph_cell] => [fax] => [notes] => Sailing Climbing [url] => [username] => [password] => [dateentered] => 2006-01-06 15:29:04 [fletter] => W ) [7] => stdClass Object ( [id] => 53 [category] => Politician [lettername] => W [fname] => Wilko [lname] => Warranski [email] => zelda@symballking.com [address] => 123 Main St Pukipsee PA 991199 [ph_home] => 999-555-1234 [ph_work] => [ph_cell] => [fax] => [notes] => Great on symballs and trumpets [url] => http://symbols.com/ [username] => [password] => [dateentered] => 2006-07-15 16:24:40 [fletter] => W ) ) Array ( [Alien] => Alien [Geek] => Geek [Politician] => Politician ) Array ( [G] => G [H] => H [L] => L [W] => W ) |