parapet74 Posted March 22, 2011 Report Share Posted March 22, 2011 I purchased your complete Php programmer course and am working through it. I need more info regarding debugging. I've watched Ben's video on debugging php, which was pretty basic, but Jon's videos also cover using print_r() and the Firefox Firebug add-in with its console.log command. However, the code he writes doesn't work on my system -- I don't get any output to the Firebug console. Perhaps it's because I use Windows... or maybe versionitis. It would be really great if you guys could put together a comprehensive debugging tutorial, covering the most helpful tools. For example, Are there other external tools you guys use besides Firebug? Why wouldn't the same console.log code Jon writes in his videos work on my Windows pc? Everything else works... (and yes, Firebug is installed and working). How to pop-up an alert() and display variable contents. Using the var_dump command. Echo and print_r() - when to use each. Making one or the other work in various situations (e.g. - in the middle of JQuery code, in HTML, in Php, etc.) Having all these topics in a single video (or written tutorial) would help immensely. I've been trying to remember where I saw Jon use console.log and have looked through 6 videos so far, and still haven't found any -- yet I know I've watched him use it at least 3 times. Please keep the pace fast. I typically watch a video several times (only the first time playing at normal speed), using rewind frequently. Great work, Stefan et al. You are creating a good resource, well worth the money. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 22, 2011 Report Share Posted March 22, 2011 Thanks for the tutorial suggestion. If you post the code you are using for console.log debugging, that may be something we can help you figure out. Quote Link to comment Share on other sites More sharing options...
parapet74 Posted March 23, 2011 Author Report Share Posted March 23, 2011 This function is being called and does log me into the SQL db, but I don't see the success message in Firebug's console: function connectToDb () { // Make connection to MySQL server if (!$this->dbConn = @mysql_connect($this->host, $this->dbUser, $this->dbPass)) { trigger_error('Could not connect to server'); $this->connectError=true; // Select database } else if ( !@mysql_select_db($this->dbName,$this->dbConn) ) { trigger_error('Could not select database'); $this->connectError=true; } else { console.log("Successful connection to MySQL database"); } } Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 23, 2011 Report Share Posted March 23, 2011 My impression is that to use console.log, you have to have FirePHP (an addon to Firebug) installed. Do you have this in place? http://www.firephp.org/ At least, FirePHP is something I have used in the past to make log messages show up within the Firebug console. Quote Link to comment Share on other sites More sharing options...
parapet74 Posted March 23, 2011 Author Report Share Posted March 23, 2011 Another tutorial that would be of great benefit would be a comprehensive overview of website security, "for dummies", aimed at the Shopping Cart and PHP customers. As a novice php-er, I realize there are security issues I must learn about. For eg, I've seen the term "SQL injectors" mentioned in various places. Also, that passwords should be encrypted using MD5 (how does one do that??) A video, or a text article, that covers the following would be of great interest: - quick overview of web site security, from the HOSTED programmer perspective * eg. What is my responsibility, and what will my hosting provider take care of? * how secure are the files and folders under my public-html (ie. "htdocs" equiv) folder? * are some folders less secure than others? * can users view my php code? How easily? Is it possible to prevent that? * how do I log into the MySQL database with a username/password if I must write the password into a PHP script? * are there security differences between html and php files? * are there any advantages to using ruby on rails over PHP? * Security issues like SQL injectors and how to protect oneself from them * Other security issues? * Encrypting passwords before storing in SQL database * converting images to Base64 and storing/retrieving from SQL table - is there any advantage to doing this? (Look at WAMPSERVER's index.php file) Quote Link to comment Share on other sites More sharing options...
parapet74 Posted March 23, 2011 Author Report Share Posted March 23, 2011 Thanks -- I hadn't heard about FirePHP. Installed it and enabled the NET panel in FireBug, but still no success. I am now getting this message in the view: Notice: Use of undefined constant console - assumed 'console' in C:\xampp\htdocs\wmp\inc\mysql.class.php Does my code look correct? Do I need to do something else to "start" FirePHP? -- EDIT -- Found the solution(s) - FirePHP is not a simple Firefox add-on... I've now downloaded the FireHPCore folder and installed it as per instructions on the garish http://www.firephp.org/HQ/Learn.htm page, and ... it's working. Quite different (code also) from the video, but it works! Thanks Ben. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 23, 2011 Report Share Posted March 23, 2011 It's been a while since I've used FirePHP for debugging purposes, and I'm actually not sure if it is what Jon was using now that I've looked at it a bit more (I'm not sure if I have seen Jon's video that you were talking about, so I'm not sure how much help I can offer.) What confuses me slightly is that it doesn't seem to use the console.log line which I thought it did, and has it's own syntax instead. I'm not sure if it started out using console.log and then added features later or what. All that said, it does what you want it to -- logging debug messages within Firebug, and the documentation can be found here: http://www.firephp.org/HQ/Install.htm'>http://www.firephp.org/HQ/Install.htm Looks like you need to: -- install the FirePHP extension to Firefox/Firebug -- add a FirePHP library to your application (http://www.firephp.org/HQ/Install.htm) -- and initialize the library before being able to display logging messages (http://www.firephp.org/HQ/Learn.htm) Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 23, 2011 Report Share Posted March 23, 2011 Found the solution(s) - FirePHP is not a simple Firefox add-on... I've now downloaded the FireHPCore folder and installed it as per instructions on the garish http://www.firephp.org/HQ/Learn.htm page, and ... it's working. Quite different (code also) from the video, but it works! If you happen to track down Jon's video that shows use of console.log, let me know. And yes, I agree the FirePHP documentation page is a bit ugly. I didn't design it. Quote Link to comment Share on other sites More sharing options...
administrator Posted March 23, 2011 Report Share Posted March 23, 2011 Man ... I'm late to the show. I see though that Ben has things well under control. Great work, Stefan et al. You are creating a good resource, well worth the money. Many thanks. Stef Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.