WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Newbie Notes #3 - What went wrong? A useful little debugging aid
Categories : PHP, Beginner Guides, Debugging Click here to Update Your Picture
Simon Booth
Date : Apr 21st 2004
Grade : 3 of 5 (graded 8 times)
Viewed : 5113
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Simon Booth
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

NewbieNotes is a little series of tips for people who are new to PHP to give them a few handy tips that the more experienced of us use often

You're sure your PHP was right but you're getting the wrong results. What went wrong?

It's usually down to doing something stupid - we've all done it, and continue to do it, no matter how long we've been writing PHP

This handy little three line function helps you work out what went wrong.


<?php
function pv($v)
  {
  echo
"<pre>\n";
 
print_r($v);
  echo
"</pre>\n";
  }
?>


That amazingly stupid bit of code can be your best friend!

You just submitted a form and nothing happenned - why not? at the top of your code throw in pv($_POST) and you can see what came through - was it what you expected?

You got a row back from a database query but your code don't work. Hit it with a pv($row) - assuming $row is the variable you got back from the database query - does it all look right?

There are loads of uses for pv() - it's your friend when things go wrong. It'll display the entire contents of an array with thousands of elements - if that's what's causing the problem.



Newbie Notes #4 - Trapping dumb MySQL query errors
Categories : PHP, Databases, MySQL, Debugging, Beginner Guides
Cut your MySQL Connections to 1 line of code
Categories : PHP, Beginner Guides, Databases, MySQL
Basic Authentication with sessions
Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions
Introduction to Language Files
Categories : PHP, Filesystem, Beginner Guides
News management class
Categories : PHP, PHP Classes, Beginner Guides
A flat file counter
Categories : PHP, Cookies, Filesystem, Beginner Guides
The class to check load time of your script VERY usefull for relatively slow applications, but not only..
Categories : PHP, PHP Classes, Debugging
PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
Different Call User Functions
Categories : PHP, Functions, Beginner Guides
Creating a Language File
Categories : PHP, Beginner Guides, Filesystem
a PHP Function to Get only the filename (remove the extension) using regular expressions.
Categories : PHP, Regexps, Beginner Guides
A beginner's session handling class
Categories : PHP, PHP Classes, Sessions, Beginner Guides
email new items in db
Categories : PHP, Email, Databases, MySQL, Beginner Guides
A very simple PHP single password cookie based login without usernames.
Categories : PHP, Cookies, Security, Beginner Guides