PHP - Smarty Template Fetch..
hey guys i have this code to grab info from database in my inv.php file
$dbConn = new DBConnection(); $i = new dbHandler($dbConn, 'inventory'); $inv = array(); $sel=mysql_query("select * from inventory"); while($row=mysql_fetch_array($sel)) { $inv[] = $row; } $smarty->assign('inventory', $inv); // Finally, display the actual page $smarty->display('InvViewAdd.tpl');How to i make it show the info on my InvViewAdd .tpl page? also if i put $inv = $i->showInv(); Similar TutorialsSo why would one use a php template engine like smarty, other than to seperate the code from html? Is this method preffered for creating larger web applications with php?
OK guys please bear with me as this is going to be a little long post. Thanks in advanced for all the help i can get. Ed I am sorry i am a noob on all this. Now on to the problem. I have on my server the aMember script installed and as some of you guys know it works with CSS and Smarty Template Engine. the Signup page is been constructed by three files .. Signup.php which in turn displays the signup.html page in my templates folder. Signup.html load or includes header.html from the same folder. Now on the header.html i put the code of the <head> tag like always <script src ...> loading all the JS libraries. But the libraries actually do not get loaded. I am uploading the three files here in a ZIP file so you guys can have a look at them and try to tell me what am i doing wrong and you guys can point me in the right direction. On the server side i am using Centos 5.5 with apache and php 5 and mySQL server. The html folder is owned not by apache but by another group. Inside the html folder the normal folders including the SMARTY folder templates and templates_c (for temporary cache files) The signup.php page is on the root folder calling the signup.html from templates and this one includes the header at the same time. All the page are CHMOD 644 and the JS are residing in a root folder named JS where all the .js files are. All the .js files are CHMOD 644 as well. Please help me ASAP. Thanks Ed Ok so i have made the page to load the data and i have my tpl file loading i just can't figure out for the life of me why it is not displaying correctly.
what it is displaying
php for the page
<?php if($Auth->isLogged()) { $aid = $Auth->loggedAid(); $limit = 10; //grab available PTC links from db output in json $db->select('*', 'ptc', 'active = 1'); if($db->returned_rows >= 1) { $username = $Auth->loggedUsername(); $time = time(); //$row = $db->fetch_assoc_all(); $smarty->assign('row', $db->fetch_assoc()); $smarty->assign('username', $username); $smarty->assign('time', $time); } else { //set var not to display ptc ads $smarty->assign("row", "No PTC are available"); } } $smarty->display('ptc_view.tpl'); ?>tpl file <!-- START content-container --> <section id="content-container" class="clearfix"> <div id="main-wrap" class="clearfix"> <div class="page_content"> <table class="table table-hover"> <tr> <th>Ad Link</th> <th>Earnings | Points</th> <th>Times Completed</th> <th>Total Visits</th> <th>Date Added</th> </tr> {foreach key=pid item=ri from=$row} <tr> <td><a href="Pages/ptcview/{$ri[0]}">{$ri[1]}</a><br/>{$ri[3]}</td> <td>{$ri[5]} | {$ri[6]} pts</td> <td>{$ri[8]}</td> <td>{$ri[7]}</td> <td>{$ri[13]}</td> </tr> {foreachelse} <tr> <td colspan="5">Sorry there are no PTC ads available right now</td> </tr> {/foreach}can someone please show me where i have gone wrong? BTW the db table does exist and there is 1 record in it. Why smarty won't find my template file?
Fatal error: Uncaught --> Smarty: Unable to load template file 'test.tpl' <-- thrown in C:\xampp\htdocs\testing\includes\smarty\sysplugins\smarty_internal_templatebase.php on line 129also did testinstall $smarty->testInstall(); Smarty Installation test... Testing template directory... C:\xampp\htdocs\testing\templates\frontend\default\tpl is OK. Testing compile directory... C:\xampp\htdocs\testing\templates_c\frontend is OK. Testing plugins directory... C:\xampp\htdocs\testing\includes\smarty\plugins is OK. Testing cache directory... C:\xampp\htdocs\testing\cache is OK. Testing configs directory... C:\xampp\htdocs\testing\configs is OK. Testing sysplugin files... ... OK Testing plugin files... ... OK Tests complete.And get template dir var_dump($smarty->getTemplateDir());array(1) { [0]=> string(55) "C:/xampp/htdocs/testing/templates/frontend/default/tpl\" } File schema htdocs -- testing -- incluses -- smarty plugins sysplugins Smarty.class.php SmartyBC.class.php -- configs configs.php -- db connect.php db.php -- configs -- cache -- templates -- frontend -- default -- css -- mages -- js -- tpl test.tpl -- backend -- templates_c -- frontend index.phpindex.php <?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('display_startup_errors', TRUE); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); ob_start(); session_start(); require 'includes/smarty/Smarty.class.php'; require 'includes/db/db.php'; require 'includes/configs/configs.php'; $page = isset($_GET['do']) ? $_GET['do'] : ''; switch($page){ case 'home'; include 'pages/home.php'; break; default: include 'pages/test.php'; break; } ob_flush(); ?>configs.php <?php $smarty = new Smarty(); $smarty->compile_check = true; $smarty->debugging = false; $smarty->cache = 1; $smarty->setTemplateDir('C:/xampp/htdocs/testing/templates/frontend/default/tpl'); $smarty->setCompileDir('C:/xampp/htdocs/testing/templates_c/frontend/default'); $smarty->setCacheDir('C:/xampp/htdocs/testing/cache'); $smarty->setConfigDir('C:/xampp/htdocs/testing/configs'); ?>test.php <?php //$success = 'Success Message'; //$error = 'Error Message'; $errors[] = 'Error one'; $errors[] = 'Error two'; $smarty = new Smarty; //$smarty->assign('success', $success); //$smarty->assign('error', $error); $smarty->assign('errors', $errors); $smarty->display('test.tpl'); ?>test.tpl {if !empty($errors)} <div id="errors"> {section name=i loop=$errors} {$errors[i]}<br /> {/section} </div> {/if} Hello all; My site is at: http://www.designtoprint.com The problem is that it looks great in everything but Internet Explorer. In I.E., it's utterly broken. I think this has a lot to do with the fact that the former developer who worked on it did everything in Smarty. I'm wondering if there's a way to automate the process of recombining all the Smarty pages back into normal .php files. Or barring that, if any of you smarter-than-me people know off the top of your heads why my site is breaking in I.E., but nothing else. Thanks! Kyle Hello, I am trying to take a calendar script and use it on my site that uses Smarty templates. I have gotten all of it to work minus one spot! I am having trouble trying to get the code below to output what I want in Smarty... I have tried many things but to no avail! Any help would be appreciated! Thanks!! Obviously I want the html output from these PHP calls but I cant figure it out! Thanks for your help! for($i=0; $i< $total_rows; $i++) { for($j=0; $j<7;$j++) { $day++; if($day>0 && $day<=$total_days_of_current_month) { //YYYY-MM-DD date format $date_form = "$current_year/$current_month/$day"; //echo $date_form_good = '<td'; //check if the date is today if($date_form == $today) { $class_today = ' class="today"'; } //check if any event stored for the date if(array_key_exists($day,$events)) { //adding the date_has_event class to the <td> and close it $event_today = ' class="date_has_event"> '.$day; //adding the eventTitle and eventContent wrapped inside <span> & <li> to <ul> $event_title = '<div class="events"><ul>'.$events[$day].'</ul></div>'; } else { //if there is not event on that date then just close the <td> tag $no_event = '> '.$day; } $close_tag= "</td>"; } else { //showing empty cells in the first and last row $mts = '<td class="padding"> </td>'; } } $close_row = "</tr><tr>"; } Hi there, I wonder if anyone can help me. I'm trying to install smarty. The problem I'm having is in choosing the correct path directory for- require('/usr/local/lib/php/Smarty/Smarty.class.php'); Granted I am relatively new to coding. I've tried using- <?php echo $_SERVER['DOCUMENT_ROOT']; ?> which returns- /usr/local/apache/htdocs I think the problem is in understanding what my local directory is. In my ftp program, the first folder looks like this firstfolder/ public_html/ ( < I've installed smarty in this one) DO_NOT_UPLOAD_HERE.txt When I run a test file index.php, I get the following error- Warning: require() [function.require]: open_basedir restriction in effect. File(/usr/local/public_html/lib/php/Smarty/Smarty.class.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a4808331/public_html/index.php on line 4 What I've put in my index.php file so far which I'm sure is wrong is- require('/usr/local/public_html/lib/php/Smarty/Smarty.class.php'); If you need more info I'd be happy to supply. Thanks in advance for your help. I am using X cart and I have tried add function that hide price until customers log in. so I added following codes to my files with notepad but I am keep getting smarty errors Error: Smarty error: [in customer/main/products_t.tpl line 161]: syntax error: 'if' statement requires arguments (Smarty_Compiler.class.php, line 1270) in /home1/lemielfa/public_html/include/lib/smarty/Smarty.class.php on line 1092 Here's Smarty.class.php line 1092 ------------------------------------------------------------------------------------------------------------------------------------- * @param string $error_msg * @param integer $error_type */ function trigger_error($error_msg, $error_type = E_USER_WARNING) { (line1092----->)trigger_error("Smarty error: $error_msg", $error_type); } /** * executes & displays the template results -------------------------------------------------------------------------------------------------------------------------------- This was my first time adding some code to my web, I hope I didn't screw up that much...... Thank You David ---------------------------------------------------------------------------------------- Following Code ADDED /b] 1. Apply following SQL statements either from your cart admin/patch area or myphpadmin. This will place 2 controls in General Settings / General options in Common options. The first one will allow you to turn this mod on/off Code: INSERT INTO `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`, `validation`) VALUES ('cflsys_hide_prices', 'Hide prices for non-logged in customers (this will also hide quantity box, "buy now" and "add to cart" buttons)', 'N', 'General', 75, 'checkbox', 'N', '', ''); INSERT INTO `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`, `validation`) VALUES ('cflsys_hide_prices_message', 'Show this optional message if the option "Hide prices" is enabled', 'You need to login in order to see prices and place orders.', 'General', 76, 'text', '', '', ''); 2. Add to init.php at the end of the file just before PHP Code: # # WARNING ! # Please ensure that you have no whitespaces / empty lines below this message. # Adding a whitespace or an empty line below this line will cause a PHP error. # this PHP Code: # added by CFL Systems for hide prices if customer not logged in $smarty->assign("cflsys_hide_prices",$config['General']['cflsys_hide_prices']); $smarty->assign("cflsys_hide_prices_message",$config['General']['cflsys_hide_prices_message']); # added by CFL Systems for hide prices if customer not logged in 3. In skin1/customer/main/products.tpl find Code: {if $config.Appearance.products_per_row && ($featured eq "Y" || $config.Appearance.featured_only_multicolumn eq "N")} {include file="customer/main/products_t.tpl"} {else} {include file="customer/main/products_list.tpl"} {/if}and before add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if $login eq "" && $cflsys_hide_prices eq "Y"} {if $cflsys_hide_prices_message ne ""} <div style="color: red; margin: 5px 0; padding: 5px 5px 5px 10px; border: 1px solid #cccccc;">{$cflsys_hide_prices_message}</div> {/if} {/if} {* added by CFL Systems to hide prices if customer not logged in *} 4. In skin1/customer/main/product.tpl (skin1/customer/main/product_details.tpl for 4.3.x, code may be slightly different) find this Code: <tr> <td class="property-name product-price">{$lng.lbl_price}:</td> <td class="property-value"> and before add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if $login eq "" && $cflsys_hide_prices eq "Y"} $nbsp; {else} {* added by CFL Systems to hide prices if customer not logged in *} then find Code: {if $product.forsale ne "B"} <tr> <td colspan="2"> {include file="customer/main/product_prices.tpl"} </td> </tr> {/if}and after add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if} {* added by CFL Systems to hide prices if customer not logged in *} then find Code: <tr> <td class="property-name product-input"> {$lng.lbl_quantity}and before add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if $login eq "" && $cflsys_hide_prices eq "Y"} <tr> <td colspan="2"> {if $cflsys_hide_prices_message ne ""} {$cflsys_hide_prices_message} {else} {/if} </td> </tr> {else} {* added by CFL Systems to hide prices if customer not logged in *}then find Code: {/if} </table> and before add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if} {* added by CFL Systems to hide prices if customer not logged in *}then find Code: {if $product.appearance.buy_now_buttons_enabled}and before add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if $login eq "" && $cflsys_hide_prices eq "Y"} $nbsp; {else} {* added by CFL Systems to hide prices if customer not logged in *}then find Code: </form>and before add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if} {* added by CFL Systems to hide prices if customer not logged in *} 5. In skin1/customer/main/products_list.tpl find Code: {if $product.product_type eq "C"} {include file="customer/buttons/details.tpl" href=$url} {else}and after add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if $login eq "" && $cflsys_hide_prices eq "Y"} $nbsp; {else} {* added by CFL Systems to hide prices if customer not logged in *} then find Code: {/if} </div> <div class="clearing"></div>and before add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if} {* added by CFL Systems to hide prices if customer not logged in *} 6. In skin1/customer/main/products_t.tpl find Code: <tr> {foreach from=$row item=product} {if $product} <td class="product-cell product-cell-price"> {if $product.product_type ne "C"} {if $active_modules.Subscriptions ne "" && $product.catalogprice} and before add Code: {if $login eq "" && $cflsys_hide_prices eq "Y"} <tr> <td colspan="2"> </td> </tr> {else} {* added by CFL Systems to hide prices if customer not logged in *}then find at the end of the file Code: {/foreach} </table> {/if}and before add Code: {* added by CFL Systems to hide prices if customer not logged in *} {if} {* added by CFL Systems to hide prices if customer not logged in *} I have a serialized array stored in a database field in the following format: Unserialized: '1' => '5000', '2' => '2000' Serialized: a:2:{i:1;s:4:"5000";i:2;s:4:"2000";} The key is a database ID and the value is just a number. Next I have a table which stores some information about each ID |ID|NAME|DESCRIPTION|ENABLED?| ----------------------------------------------------- 1 | Test | Description goes here| TRUE 2 | Hello | World | TRUE What I want to do is fetch the serialized values from database, unserialize them and then loop through them using the smarty template engine. The thing is that I want to include some more information, that fetched from the database, based on the KEY of the array. I suck at explaining crazy stuff like this so I'll just provide some images and code to help out Current I have this PHP code ( I had no idea on how to approach the problem so I just wrote stuff I thought would work ): <?php require_once ( 'common-ingame.php' ); $template->assign ( 'page_title', 'Faction Standings' ); $unserialized = unserialize ( $characterInfo['charactersREPUTATION'] ); # IE: a:2:{i:1;s:4:"5000";i:2;s:4:"2000";} $names = array ( ); foreach ($unserialized as $faction_id => $faction_reputation) { $data = mysql_Fetch_assoc ( mysql_query ( "SELECT `worldfactionNAME` FROM `world_factions` WHERE `worldfactionID` = {$faction_id}" ) ); $names[] = $data['worldfactionNAME']; } $final_array = array_combine ( $unserialized, $names ); $template->assign ( 'reputation', $final_array ); $template->display ( 'my-rep.tpl' ); Smarty Template File . TPL Code: [Select] {include file="include/header-ingame.tpl"} <h3>Faction Standings</h3> <table class='ng-table'> <tr><th>Faction</th><th>Reputation</th></tr> {foreach from=$reputation key=faction_name item=faction_reputation} <tr><td>{$faction_reputation}</td><td>{$faction_name} / 10000</td></tr> {/foreach} </table> {include file="include/footer-ingame.tpl"} Screenshot of results is attached What I want to do is add extra information, fetched from the database, to the table. My table structu |FACTIONID|FACTION NAME|FACTION DESCRIPTION| FACTION ENABLED? ( NOT USED YET)| ----------------------------------------------------------------------------------------------------------------------- 1 Horus Brotherhood Description 1 TRUE 2 Darkmist Clan Description 2 TRUE Currently all that's being displayed is the faction name, which is selected based on the array key, and the reputation value which is fetched from the array value. What I want to do is add the description column value to the table. Anyone care to help? Quote Hello, Am a newbie using PEAR packages in my coding. I installed smarty on XAMPP recently and followed the configuration process in the 'php.ini' file, labelling the path to the '\libs\' directory. Before installation of smarty, my pear packages were working fine, never received any errors. However, after installing smarty and including my template file 'config.php' with 'Auth/HTTP.php' within the same file, i gor these errors; Warning: require_once(Auth/HTTP.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\OReilly\pear\blog\login.php on line 10 Fatal error: require_once() [function.require]: Failed opening required 'Auth/HTTP.php' (include_path='.;C:\xampp\smarty\libs') in C:\xampp\htdocs\OReilly\pear\blog\login.php on line 10 Warning: Cannot modify header information. Headers already sent by C:\xampp\htdocs\OReilly\pear\blog\login.php on line 10 Anybody got ideas what i can do to correct this issue, thanks. I have attached my templates file 'config.php' and my login script, the one that allows users to login be fore they access results to the database called 'login.php' This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=357370.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=355225.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=321319.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=319414.0 Hi. I am a little confused about PDO, its classes and the general oop aspects of it. If you at the below code:
<?php try { $handler = new PDO('mysql:host=127.0.01;dbname=app', 'root',''); $handlser->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }catc(PDOException $e) { echo $e->getMessage(): die(); } $query = $handler->query('SELECT * FROM table'); while($r = $query->fetch(PDO::FETCH_OBJ)) { echo $r->message; }What's confusing me is that the fetch method is a method within the PDOSTATEMENT class so how come an object hasn't been created before hand in order to use the method? Furthermore it appears the method is a static method within the PDOSTATEMENT class so how come the double semi colon is being used such as: PDOSTATEMENT::FETCH? Any help would be appreciated. Thanks. Hello, i have a query that returns multiple results but in my php query it only returns the first result...ive been checking google on while loops but still havent gotten it to work...would love if someone could look at it...thanks Code: [Select] // while ($result= mysql_fetch_array($stmt)){ while ($stmt->fetch()) { break; // $stmt->close(); // Return unlock code, encoded with JSON $result[] = array( "l_name"=>$l_name, "f_name"=>$f_name, "birth"=>$birth, "expires"=>$expires, ); sendResponse(200, json_encode($result)); return true; sendResponse(400, 'Invalid request'); return false Okay so, I have always been curious, just never have taken the time to ask someone / learn what the differences are in fetches. What does mysql_fetch_array and mysql_fetch_row do thats different from each other? When pulling data from the database, would I like fetch array, or fetch row? or even fetch assoc? Thanks! I have this code and Im using a while to fetch all the data where users comments are but i want to change it to fetch only 25 rows at a time and each time it refreshes it fetch's 25 more different rows. Code: [Select] <?php include "../../connect.php"; Header('Cache-Control: no-cache'); Header('Pragma: no-cache'); $username = mysql_real_escape_string($_GET['username']); //If friend is set, then query for it, otherwise return all of the friends comments. $friend = (isset($_GET['friend'])) ? ' AND b.friend = \'' . mysql_real_escape_string($_GET['friend']) . '\' ' : NULL; $sql = "SELECT a.username,a.comment,a.timestamp,a.title,a.picture,a.pic_status,a.pic_url,b.id,c.avatar,c.atimestamp,c.onlinestatus FROM (user_comments as a JOIN accounts as c USING(username))JOIN `user_friends_list` as b ON (b.friend = a.username)WHERE (b.username = '$username' $friend AND b.status = 1) ORDER BY a.id DESC"; $result = mysql_query($sql); $user_xml = "<?xml version=\"1.0\"?>\n"; //$user_xml .= "<root>\n"; if(mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $user_xml .= "<comment>\n"; $user_xml .= "<image>" . $row['avatar'] . "</image>\n"; $user_xml .= "<name>" . $row['username'] . "</name>\n"; $user_xml .= "<text>\n"; $user_xml .= "<![CDATA[ ". $row['comment'] ."]]>\n"; $user_xml .= "</text>\n"; $user_xml .= "<time>" . $row['timestamp'] . "</time>\n"; $user_xml .= "<title>" . $row['title'] . "</title>\n"; $user_xml .= "<picture>" . $row['picture'] . "</picture>\n"; $user_xml .= "<status>" . $row['pic_status'] . "</status>\n"; $user_xml .= "<url>" . $row['pic_url'] . "</url>\n"; $user_xml .= "<ntimestamp>" . $row['atimestamp'] . "</ntimestamp>\n"; $user_xml .= "<online>" . $row['onlinestatus'] . "</online>\n"; $user_xml .= "</comment>\n"; } } //$user_xml .= "</root>\n"; echo $user_xml; ?> So i think i can do something like this but im not to sure. just add a if statement Code: [Select] while ($row = mysql_fetch_assoc($result)) { $user_xml .= "<comment>\n"; $user_xml .= "<image>" . $row['avatar'] . "</image>\n"; $user_xml .= "<name>" . $row['username'] . "</name>\n"; $user_xml .= "<text>\n"; $user_xml .= "<![CDATA[ ". $row['comment'] ."]]>\n"; $user_xml .= "</text>\n"; $user_xml .= "<time>" . $row['timestamp'] . "</time>\n"; $user_xml .= "<title>" . $row['title'] . "</title>\n"; $user_xml .= "<picture>" . $row['picture'] . "</picture>\n"; $user_xml .= "<status>" . $row['pic_status'] . "</status>\n"; $user_xml .= "<url>" . $row['pic_url'] . "</url>\n"; $user_xml .= "<ntimestamp>" . $row['atimestamp'] . "</ntimestamp>\n"; $user_xml .= "<online>" . $row['onlinestatus'] . "</online>\n"; $user_xml .= "</comment>\n"; } I only wnat to read 25 comments at a time and when i click a button to read more then it reads 25 more rows but it dose not read the data unless requested... can any one help me? Hi all, I need some help with my code as I have a hard time with fetching the value from the stdclass. I am using json data to convert it to PHP so I would like to fetch the "appears" data from the stdclass object. When I try this: echo $data->appears;
I'm getting this: Notice: Trying to get property of non-object in /home/username/public_html/foldername/script.php on line 22
I have also tried this: echo $data[0]->appears->value;
And this: echo $data->appears[0]->value;
I am still get the same error so I dont know what to do to resolve it.
Full code: <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $json = '{"data":{"185.220.101.46":{"domains_count":0,"domains_list":null,"updated":"2019-12-02 22:04:25","spam_rate":1,"frequency":6827,"frequency_time_24h":106,"frequency_time_1h":2,"network_type":"hosting","in_antispam":1,"in_security":0,"appears":1,"country":"DE","submitted":"2018-01-11 20:34:37","frequency_time_10m":2,"sha256":"e39d4a9be2f210d1a75ba2b5ece08a4b35e99002b03aeb6ceaad1d98de87c248"}}}'; // Converts it into a PHP object $data = json_decode($json, true); //print_r($data); echo $data["appears"]->value ."<br/>"; //var_dump($data[1]->{'updated'}); //echo $data->updated[1]->value; ?>
STDClass object: Array ( [data] => Array ( [185.220.101.46] => Array ( [domains_count] => 0 [domains_list] => [updated] => 2019-12-02 22:04:25 [spam_rate] => 1 [frequency] => 6827 [frequency_time_24h] => 106 [frequency_time_1h] => 2 [network_type] => hosting [in_antispam] => 1 [in_security] => 0 [appears] => 1 [country] => DE [submitted] => 2018-01-11 20:34:37 [frequency_time_10m] => 2 [sha256] => e39d4a9be2f210d1a75ba2b5ece08a4b35e99002b03aeb6ceaad1d98de87c248 ) ) )
Var_dump: array(1) { ["data"]=> array(1) { ["185.220.101.46"]=> array(15) { ["domains_count"]=> int(0) ["domains_list"]=> NULL ["updated"]=> string(19) "2019-12-02 22:04:25" ["spam_rate"]=> int(1) ["frequency"]=> int(6827) ["frequency_time_24h"]=> int(106) ["frequency_time_1h"]=> int(2) ["network_type"]=> string(7) "hosting" ["in_antispam"]=> int(1) ["in_security"]=> int(0) ["appears"]=> int(1) ["country"]=> string(2) "DE" ["submitted"]=> string(19) "2018-01-11 20:34:37" ["frequency_time_10m"]=> int(2) ["sha256"]=> string(64) "e39d4a9be2f210d1a75ba2b5ece08a4b35e99002b03aeb6ceaad1d98de87c248" } } }
Can you please show me an example how I can fetch the `appears` from the stdclass object? Any advice would be much appreciated. Edited December 2, 2019 by mark107 |