PHP - Stdclass Object
I have been trying to access an stdClass I can't. This stdClass gets returned from a method in a class . below the query is right all I want to do is put admi into a session var but I can't seem to access the obj. I can print_r and it displays. I am sure that it is easy. being new to PDO I am getting lost at times. Any help would be greatfully recieved
Code: [Select] stdClass Object ( [Admin_Level] => admi ) Similar TutorialsHi 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 mark107Hi guys, I have below values in array Code: [Select] stdClass Object ( [Category] => stdClass Object ( [ChildCategoryDescription] => 50s / 60s ERA [ChildCategoryID] => 87 [GrandchildCategoryDescription] => - [GrandchildCategoryID] => 25 [ParentCategoryDescription] => CONCERTS [ParentCategoryID] => 2 ) [Description] => Tony Bennett [ID] => 1073 [HomeVenueID] => 0 ) When am calling Desciption object by $resultsObj->Description then i got the result " Tony Bennett" but i do not know to get the value GrandchildCategoryID . Just i tried this Code: [Select] echo $resultsObj->$resultsObj->ParentCategoryID and i got below error. Catchable fatal error: Object of class stdClass could not be converted to string in D:\Program Files\xampp\htdocs\t1\genericLib.php on line 255. How i can get this value... I have a stdClass Object Multi Dimensional Array that I need to dissassemble into variables but dont know how to pull the data. The array looks like this: Code: [Select] stdClass Object ( [results] => Array ( [0] => stdClass Object ( [address_components] => Array ( [0] => stdClass Object ( [long_name] => 1600 [short_name] => 1600 [types] => Array ( [0] => street_number ) ) [1] => stdClass Object ( [long_name] => Pennsylvania Ave NW [short_name] => Pennsylvania Ave NW [types] => Array ( [0] => route ) ) [2] => stdClass Object ( [long_name] => Northwest Washington [short_name] => Northwest Washington [types] => Array ( [0] => neighborhood [1] => political ) ) [3] => stdClass Object ( [long_name] => Washington [short_name] => Washington [types] => Array ( [0] => locality [1] => political ) ) [4] => stdClass Object ( [long_name] => District of Columbia [short_name] => DC [types] => Array ( [0] => administrative_area_level_1 [1] => political ) ) [5] => stdClass Object ( [long_name] => United States [short_name] => US [types] => Array ( [0] => country [1] => political ) ) [6] => stdClass Object ( [long_name] => 20500 [short_name] => 20500 [types] => Array ( [0] => postal_code ) ) ) [formatted_address] => 1600 Pennsylvania Ave NW, Washington, DC 20500, USA [geometry] => stdClass Object ( [location] => stdClass Object ( [lat] => 38.8987149 [lng] => -77.0376555 ) [location_type] => ROOFTOP [viewport] => stdClass Object ( [northeast] => stdClass Object ( [lat] => 38.900063880291 [lng] => -77.036306519708 ) [southwest] => stdClass Object ( [lat] => 38.897365919709 [lng] => -77.039004480291 ) ) ) [partial_match] => 1 [types] => Array ( [0] => street_address ) ) ) [status] => OK ) Really I need to start with pulling the lat and lng from the location. No clue how to get to this data. why do i keep getting this error from line 7? Object of class stdClass could not be converted to string Code: [Select] <?php include_once"../includes/db_connect.php"; $item_number="2"; $custom="54298"; $query=mysql_query("SELECT `prodID`, `quanity` FROM `cart` WHERE `sessID`='$custom'") or mysql_error(); while($cart=mysql_fetch_object($query)){ mysql_query("INSERT INTO `orderItems` ( `id` , `orderInfoID` , `productID` , `quanity` ) VALUES ('', '$item_number', '$cart-> prodID', '$cart->quanity');"); } mysql_query("UPDATE `cart` SET `show`='1' WHERE `sessID`='$custom'"); ?> Hi i'm struggling to pull data from an stdClass Object which searches google for an item. This is the code that pulls out the information Code: [Select] <?php $encoded_response = file_get_contents("https://www.googleapis.com/shopping/search/v1/public/products?key=AIzaSyDCrZzoEB46bliROIn8JgOImm0B5YvxbVY&country=US&q=0014633144796"); $response = json_decode($encoded_response); print_r($response); ?> (can be seen at:http://www.rafoggin.com/Shrop/googletestapi.php i've tried Code: [Select] $object = $result[0]; $print = $object->kind; echo $print and Code: [Select] foreach ($result->product as $print) { echo $print->googleId;and many other variations but can't get it to work. ideally i'd like to pull the images out, but the structure confuses me. Your help is really appreciated, I can't figure this out. hi, very strange issue. when I create test e-mail or I will forward the specific e-mail, the script works correctly - saves attachment into server disk. now, when I configure to check another mailbox, it gives me error: Num Messages 11 Fatal error: Cannot use object of type stdClass as array in /test/emailattach/index.php on line 34 index.php: Code: [Select] <?php $mbox = imap_open("{mail.server.com:143}", "email@email", "XXX") or die('Cannot connect to mail: ' . imap_last_error()); // make connection with mailbox and check # messages if ($hdr = imap_check($mbox)) { echo "Num Messages " . $hdr->Nmsgs ."\n\n<br><br>"; $msgCount = $hdr->Nmsgs; } else { echo "failed"; } $overview=imap_fetch_overview($mbox,"1:$msgCount",0); $size=sizeof($overview); // get message info for($i=$size-1;$i>=0;$i--) { $val=$overview[$i]; $msg=$val->msgno; $from=$val->from; $date=$val->date; $subj=$val->subject; $seen=$val->seen; $from = ereg_replace("\"","",$from); // Check for attachements and store them $struct = imap_fetchstructure($mbox,$msg); $contentParts = count($struct->parts); if ($contentParts >= 2) { for ($ix=2;$ix<=$contentParts;$ix++) { $att[$ix-2] = imap_bodystruct($mbox,$msg,$ix); } for ($k=0;$k<sizeof($att);$k++) { if ($att[$k]->parameters[0]->value == "us-ascii" || $att[$k]->parameters[0]->value == "US-ASCII") { if ($att[$k]->parameters[1]->value != "") { $FileName[$k] = $att[$k]->parameters[1]->value; $FileType[$k] = strrev(substr(strrev($FileName[$k]),0,4)); } } elseif ($att[$k]->parameters[0]->value != "iso-8859-1" && $att[$k]->parameters[0]->value != "ISO-8859-1") { $FileName[$k] = $att[$k]->parameters[0]->value; $FileType[$k] = strrev(substr(strrev($FileName[$k]),0,4)); $fileContent = imap_fetchbody($mbox,$msg,$file+2); $fileContent = imap_base64($fileContent); $localfile = fopen("$FileName[$k]","w"); fputs($localfile,$fileContent); fclose($localfile); } } } } imap_close($mbox); ?> Could there be some encoding issue? with thanks, Margus Hi Guys, I need help I have setup a code recently : this is the code : $za['MIN(spec_positionid)'] and it gave me an error saying : Cannot use object of type stdClass as array but if I change to this : $za->spec_positionid it works, but I need to get the MIN value from the database. can someone please help. this is very urgent for me..... Hello together, i ve got a script what returns the html code from anonther side. $CR_URL= 'https://nomoreangel.de/api-reader/?apiid=cr-de-148-f9ea2d50ee296914d740c8bde66cc3bb761b1560&rawOut=on'; $html = file_get_html($CR_URL); $ret = $html->find('pre', 0); echo $ret; echo $ret gives me following Output:
stdClass Object ( [repaired_defenses] => Array ( ) [generic] => stdClass Object ( [cr_id] => f9ea2d50ee296914d740c8bde66cc3bb761b1560 [event_time] => 2021-03-05T23:17:59+01:00 [event_timestamp] => 1614982679 [combat_coordinates] => 1:22:11 [combat_planet_type] => 1 [combat_rounds] => 0 [loot_percentage] => 75 [winner] => attacker [units_lost_attackers] => 0 [units_lost_defenders] => 0 [attacker_count] => 1 [defender_count] => 1 [loot_metal] => 843324 [loot_crystal] => 431284 [loot_deuterium] => 226605 [combat_honorable] => [attacker_honorable] => [attacker_honorpoints] => 0 [defender_honorable] => [defender_honorpoints] => 0 [moon_created] => [moon_chance] => 0 [moon_size] => 0 [moon_exists] => 1 [debris_metal_total] => 0 [debris_crystal_total] => 0 [debris_metal] => 0 [debris_crystal] => 0 [debris_reaper_metal_retrieved] => 0 [debris_reaper_crystal_retrieved] => 0 [debris_pathfinder_metal_retrieved] => 0 [debris_pathfinder_crystal_retrieved] => 0 [wreckfield] => Array ( ) ) [attackers] => Array ( [0] => stdClass Object ( [fleet_owner] => Kurzer [fleet_owner_id] => 110574 [fleet_owner_character_class_id] => 3 [fleet_owner_coordinates] => 1:170:15 [fleet_owner_planet_type] => 1 [fleet_owner_planet_name] => suche_deut [fleet_owner_alliance] => Eis Kalte Engel [fleet_owner_alliance_tag] => EKE [fleet_armor_percentage] => 210 [fleet_shield_percentage] => 210 [fleet_weapon_percentage] => 220 [fleet_composition] => Array ( [0] => stdClass Object ( [ship_type] => 219 [armor] => 7130 [shield] => 310 [weapon] => 640 [count] => 311 ) ) ) ) [defenders] => Array ( [0] => stdClass Object ( [fleet_owner] => Croupier [fleet_owner_id] => 114969 [fleet_owner_character_class_id] => 3 [fleet_owner_coordinates] => 1:22:11 [fleet_owner_planet_type] => 1 [fleet_owner_planet_name] => Suche deut [fleet_owner_alliance] => [fleet_owner_alliance_tag] => [fleet_armor_percentage] => 120 [fleet_shield_percentage] => 120 [fleet_weapon_percentage] => 120 [fleet_composition] => Array ( ) ) ) [rounds] => Array ( ) ) Now i want to get access to these Object, but because it is a string, i can t access the values.
Can somebody help me? error Notice: Undefined property: stdClass::$post_url in /home/sites/inspiredanceacademy.com/public_html/sno-blog-test/lib/social_news_office.php on line 133 Notice: Undefined property: stdClass::$post_title in /home/sites/inspiredanceacademy.com/public_html/sno-blog-test/lib/social_news_office.php on line 133 Notice: Undefined property: stdClass::$post_date in /home/sites/inspiredanceacademy.com/public_html/sno-blog-test/lib/social_news_office.php on line 137 Notice: Undefined variable: fb in /home/sites/inspiredanceacademy.com/public_html/sno-blog-test/lib/social_news_office.php on line 138 Notice: Undefined variable: tw in /home/sites/inspiredanceacademy.com/public_html/sno-blog-test/lib/social_news_office.php on line 140 Posted Posted on | Facebook Facebook Twitter Twitter Notice: Undefined property: stdClass::$post_content in /home/sites/inspiredanceacademy.com/public_html/sno-blog-test/lib/social_news_office.php on line 153 Notice: Undefined property: stdClass::$post_url in /home/sites/inspiredanceacademy.com/public_html/sno-blog-test/lib/social_news_office.php on line 154 http://www.socialnewsoffice.com/blog_posts?start=0&api_key=b5cbd66dca99c49d1a6c3d ive used this a my json Code: [Select] //check if you have curl loaded if(!function_exists("curl_init")) die("cURL extension is not installed"); function Social_News_Office($action, $api_key){ // jSON URL which should be requested $json_url = $action.'&api_key='.api_key.''; // Initializing curl $ch = curl_init( $json_url ); // Configuring curl options $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array('Content-type: application/json') , ); // Setting curl options curl_setopt_array( $ch, $options ); // Getting results return $result = json_decode(curl_exec($ch)); // Getting jSON result string } $blog_posts = Social_News_Office('http://www.socialnewsoffice.com/blog_posts?start=2&display=6', api_key); foreach($blog_posts as $post) { echo '<!--START OF POST--> <div class="post"> <h2 class="post-heading"><a href="' . BLOG_BASE_URL . 'article/' . $post->post_url . '/">' . strip_tags($post->post_title) . '</a></h2> <!--START OF BLOG INFO--> <p class="meta"> <img alt="Posted" class="meta-img" src="http://www.socialnewsoffice.com/blog-images/time.png"> Posted on ' . $post->post_date . ' | <a target="_blank" href="'.$fb.'" class="socialusers icon Facebook"> <img alt="Facebook" src="http://www.socialnewsoffice.com/blog-images/facebook.png"> Facebook </a> <a target="_blank" href="http://twitter.com/#!/'.$tw.'" class="socialusers icon Twitter"> <img src="http://www.socialnewsoffice.com/blog-images/twitter.png" alt="Twitter" align="baseline"> Twitter </a> </p> <!--START OF POST CONTENT--> <div class="post-content">'; if(!empty($post->article_img)){ echo '<a href="' . BLOG_BASE_URL . 'article/' . $post->post_url . '/"> <img alt="' . strip_tags($post->post_title) . '" class="post-thumbnail" src="' . BLOG_BASE_URL . 'sno-blog/thumbnail.php?file='.$post->article_img.'&width=240&height=160" title="' . strip_tags($post->post_title) . '"></a>'; } echo '<p>' . $post_content = substr(strip_tags($post->post_content,'<p><br><a>'),0,266).'...' . '</p> <a class="read-more" href="' . BLOG_BASE_URL . 'article/' . $post->post_url . '/">Continue reading</a> <div class="clear"></div> </div><!--END OF POST CONTENT--> </div><!--END OF POST-->'; } I am using the following code
foreach ($fbdata->data as $post ) { $posts .= '<li>'; $posts .= '<p>' . $post->message . '</p>'; $posts .= date('d-M-y', strtotime($post->created_time)); $posts .= '</li>'; } and if the message propeerty doesn't exist I get the message above. Any ideas on the best way to fix this? Hey all, I want to have an object that has a property which is an object containing instances of other objects. I try this: Code: [Select] class Blog extends Posts { public $has_posts; public function __construct($a,$b,$c){ $has_posts = (object) array_merge((array) $a, (array) $b, (array) $c); } } class Posts { public $b; public function __construct($b){ $this->b = $b; } } $post1 = new Posts(1); $post2 = new Posts(2); $post3 = new Posts(3); $blog = new Blog($post1,$post2,$post3); var_dump($blog->has_posts); //null foreach($blog->has_posts as $post){ //Invalid argument supplied for foreach() echo $post->b; } But as you see, has_posts is null, not an object containing other objects. Thanks for response. I have a Soup object in a Bowl object in a Microwave object. The Microwave object has the methods: receiveItem(Bowl $b) cookItem(???) I want the Microwave to be able to set the Soup->temperature but I'm not how to do that? Make sense? TomTees I made a small script and it says that my database object isn't an object. I connect to my pdo database via: <?php try { $db = new PDO("mysql:host=localhost;dbname=database", "root", "root"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { echo $e->getMessage(); } ?> The error I get is Code: [Select] Notice: Undefined variable: db in /Users/JPFoster/Sites/jobiji_sandbox/extensions/tasks.php on line 21 Fatal error: Call to a member function query() on a non-object in /Users/JPFoster/Sites/jobiji_sandbox/extensions/tasks.php on line 21 here's where the error is $grabber = $db->query('SELECT * WHERE user_id =' . $userid); $grabber->setFetchMode(PDO::FETCH_OBJ); while ( $row = $grabber->fetch() ){ $display = '<div>Task Name: ' . $row->name .'</div>'; $display .= '<div>Task Details: <p>'. $row->details .'</p></div>'; //$display .= '<div>'. $this->checkifDone($row->task_status) .'</div>'; $display .= '<div>Task Due: '. $row->task_due . '</div>'; echo $display; } could anyone tell me where this issue is originating I followed a fairly simple tutorial that didn't seem to work. Thanks! Hi I have a login script which goes at the top of several pages in my site. It works fine but I am trying to save some coding and re-writing out my script at the top of each of the pages. Instead I have made a page called login.php and put all of the code for the script in there. Looks like this.... <?php //login script if(isset($_POST['log'])) { $emaillog = stripslashes($_POST['emaillog']); $passwordlog = stripslashes($_POST['passwordlog']); $emaillog = mysql_real_escape_string($_POST['emaillog']); $passwordmd5 = md5($passwordlog); //generate random session id which i want to follow the user round the site! $CheckUser = "SELECT * FROM members WHERE email='".$emaillog."' AND password='".$passwordmd5."'"; $userDetails2 = mysql_query($CheckUser); $userInfo = mysql_fetch_array($userDetails2); $count = mysql_num_rows($userDetails2); if($count != 0) { $_SESSION['memberID'] = $userInfo['memberID']; $_SESSION['accesslevel']= $userInfo['accesslevel']; $_SESSION['email']= $userInfo['email']; //add an id that will be carried throughout the user until the session is destroyed function getUniqueCode2($length2 = "") { $code2 = md5(uniqid(rand(), true)); if ($length2 != "") return substr($code2, 0, $length2); else return $code2; } $randomKey = getUniqueCode2(25); $_SESSION['key'] = $randomKey; //the user must have an access level of 2, before they can login if($_SESSION['accesslevel']=='2') $url = "loggedin/index.php"; header("Location: ".$url.""); $success = '1'; } else { $success = '0'; $logged = "incorrect login details" or die(mysql_error()); } //now we need to update the login table to reflect a login if($success =='1'){ $time = date("Y-m-d h:m:s"); $qupdate_mem_logins = "INSERT INTO logindetails (`email`,`time`) VALUES ('".$emaillog."','".$time."')"; $rupdate_mem_logs = mysql_query($qupdate_mem_logins) or die(mysql_error()); ?> Now on the index page how do I reffer to this login script when someone fills in the form At the minute I have the following code but it is not checking or running anything. <?php //login script if(isset($_POST['log'])) { include('login.php'); } } ?> Ok. So, I'm trying to retrieve the id value from an object. Here is the code I have that works so far: Code: [Select] $object = 'object'; $koid = $this->$object; echo '<pre>'; print_r($koid); echo '</pre>'; and this is what is returns: Code: [Select] Order Object ( [id:protected] => 5 [stand_by:protected] => test [problem:protected] => test ) what do I need to do to make $koid equal the id value (5 in this case)? I've been trying to solve this issue for so long now.. I believe I'm close, but it's just the last part that I can't figure out how to solve.. I have a set of parsers and a controller. each parser is in it's own object named like Parsers_Imdb_Imdb.. What I want now is to be able to do this Code: [Select] $parse = new Parsers; $imdb = $parse->Imdb->get_info('some random info'); So far I've managed to get into the Imdb parser object, but I 'm not able to grab the method. parsers.php Code: [Select] class Parsers { function __construct() { } public function Imdb() { new Parsers_Imdb_Imdb; } } imdb.php Code: [Select] class Parsers_Imdb_Imdb extends Parsers { function __construct() { parent::__construct(); } public function get_info() { echo "get_info()"; } } I've got a __autoload() to solve the class declaration.. Could anyone please help me out with this? Thanks in advance ok that works fine can i store a object tag in the db and show that same obj tag in the div ill paste my code but its hard coded <div id="resultmedia"> <object width="640" height="385"> <param name="movie" value="http://www.youtube.com/v/vFagaB9M6nQ?fs=1&hl=en_GB"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/vFagaB9M6nQ?fs=1&hl=en_GB" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="155" height="131"> </embed></object> hello all, I am new to php, and getting better using the object oriented approach. I have been a procedural programmer for several years, with a limited exposure to OOP. I have a question about pulling two values from an object. the following code is an excerpt from a class form. function getstocklist($currentcount){ $transactions = $currentcount['count']; $current = mysql_query("SELECT * FROM current_positions WHERE positiontype = 'long' OR positiontype = 'short'"); $tickers = ''; while ($stock = mysql_fetch_array($current)){ $tickers .= $stock['positionticker'] . ','; $stockList[] = array( 'shares' => round(($stock['positioncost']/$stock['positionprice']),0), 'date' => date("m/d/Y G:i:s", $stock['positiontime']-(45*60)), 'ticker' => $stock['positionticker'], 'type' => $stock['positiontype'], 'price' => $stock['positionprice'], ); } return($tickers); } I would like to get both the value of $tickers and the array $stockList. I am not sure how to proceed. any suggestions would be greatly appreciated. Thanks Kansas I am trying to get elements in a dom object to display and manipulate however i cant seem to get them all out: This is the feed: <TransactionList> <TransactionID>507821041</TransactionID> <TransactionDate>2012-03-12T13:23:00+00:00</TransactionDate> <MerchantID>547</MerchantID> <MerchantName>The High Street Web</MerchantName> <ProgrammeID>1865</ProgrammeID> <ProgrammeName>THE HIGHSTREET WEB</ProgrammeName> <TrackingReference>{CLICKID}</TrackingReference> <IPAddress>82.34.245.167 </IPAddress> <SaleValue>0.0000</SaleValue> <SaleCommission>0.0400</SaleCommission> <LeadCommission>0.0000</LeadCommission> </TransactionList> However i am trying to get more than 1 tag but i cant seem to get it right. This is my code: <?php $dom = new DomDocument; $dom -> load ( "http://xyz.com" ); $tracking = $dom -> getElementsByTagName( "TrackingReference" ); //$com = $dom -> getElementsByTagName( "SaleCommission" ); $c1 = 0; foreach( $tracking as $code ) { #echo $code -> textContent.'<br>'; $tcode = $code -> textContent; $tcom = $com -> textContent; //$com = $dom -> getElementsByTagName( "SaleCommission" ); if ($tcode !="") { $remove_it = '{CLICKID}'; $tcode = str_replace($remove_it, "", $tcode); echo $tcode.' VALUE '. $com .'<br>'; $c1 ++; } } echo 'Total Count: '.$c1; ?> Please can someone help and tell me where im going wrong! Hi all, have constructed a blog through some tutorials which will add and delete messages. I wish to add some form of confirmation box with a yes/no button before deleting but am not sure where to begin. Thanks for any help <?php // Command_BlogDelete.php //############################################################################ // SearchVenueCommand class //############################################################################ class Command_BlogDelete extends Command { //############################################################################ // doExecute //############################################################################ function doExecute(Request $request) { // Get data from request $id = $request->getProperty('id'); // Create manager object $manager = new ManagerMessage(); // Add to database $manager->deleteMessage($id); // Redirect to index header("location:index.php"); } } ?> |