Jump to content

Search the Community

Showing results for tags 'firephp static trace'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 1 result

  1. Hi, I am trying to use the FirePHP addon for Firefox to debug my PHP pages. I currently following training and feel the need to be able to have some introspection into what is going on. My knowledge of PHP is basic and I have just started really learning Object Oriented PHP. I don't find it easy to follow the trail of execution in a set of PHP files. So I wanted to use FirePHP to help. I am wondering what I am doing wrong and is anybody can help. I cannot seem to understand how to insert the code into the current pages to trace function execution. My code FirePHP code is around line 35 in the function find_by_sql. Could the fact that I am trying to use this on a static function be the problem. Thanks <?php ob_start(); // this is from the Lynda.com title PHP Beyond the Basics // If it's going to need the database, then it's // probably smart to require it before we start require_once('database.php'); require_once('../../FirePHPCore/fb.php'); class User { public $id; public $username; public $password; public $first_name; public $last_name; public static function find_all() { global $database; //$result_set = $database->query("SELECT * FROM users"); //return $result_set; return self::find_by_sql("SELECT * FROM users"); } public static function find_by_id($id=0) { global $database; $result_array = self::find_by_sql("SELECT * FROM users WHERE id={$id} LIMIT 1"); return !empty($result_array)? array_shift($result_array) : false; } public static function find_by_sql($sql="") { global $database; $firephp = FirePHP::getInstance(TRUE); $result_set = $database->query($sql); $object_array = array(); while ($row = $database->fetch_array($result_set)) { $object_array[] = self::instantiate($row); } $firephp->fb('Hello World!', FirePHP::TRACE); return $object_array; } public static function authenticate($username="", $password="") { global $database; $username = $database->escape_value($username); $password = $database->escape_value($password); $sql = "SELECT * FROM users "; $sql .= "WHERE username = '{$username}' "; $sql .= "AND password = '{$password}' "; $sql .= "LIMIT 1"; $result_array = self::find_by_sql($sql); return !empty($result_array) ? array_shift($result_array) : false; } public function full_name() { if(isset($this->first_name) && isset($this->last_name)) { return $this->first_name . " " . $this->last_name; } else { return ""; } } private static function instantiate($record) { // Could check that $record exists and is an array // Simple, long-form approach: $object = new self; //$object->id = $record['id']; //$object->username = $record['username']; //$object->password = $record['password']; //$object->first_name = $record['first_name']; //$object->last_name = $record['last_name']; //return $object; // More dynamic, short-form approach foreach($record as $attribute=>$value){ if($object->has_attribute($attribute)) { $object->$attribute = $value; } } return $object; } private function has_attribute($attribute) { // get_object_vars returns an associative array with all attributes // (incl. private ones!) as the keys and their current values as the value $object_vars = get_object_vars($this); // We don't care about the value, we just want to know if the key exits // Will return ture or false return array_key_exists($attribute, $object_vars); } } ?>
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.