Debugging 101
Results 1 to 15 of 61

Thread: Debugging 101

Threaded View

  1. #1
    Parse error line -1 Bunkermaster's Avatar
    Join Date
    Sep 2002
    Location
    France
    Posts
    1,769

    Exclamation Debugging 101

    As mentioned in a post I recently read http://www.phpbuilder.com/board/show...eadid=10240313 (not all of it, it seams some people can't stop talking here so fast it's like IRC now) some people have NO IDEA whatsoever about debugging and actually finding errors so here are my useless hints :

    1. When you code a MySQL query use new lines :
    PHP Code:
    $sql "SELECT
            `yourtable`,`field1` as f1,
            `yourtable`,`field2` as f2
            FROM
            `yourtable`
            "

    Why? If you have an error MySQL will give you line number referencing a line INSIDE the query. Always saves time to actually be able to use the info.

    2. When you code a MySQL query echo it in a HTML comment (not in production) :
    PHP Code:
    $sql "SELECT
            `yourtable`,`field1` as f1,
            `yourtable`,`field2` as f2
            FROM
            `yourtable`
            "
    ;
    echo 
    "<!--\n$sql\n-->"
    Why? Well if your pages doesn't work try running your querries in phpMyAdmin or your DB manager and see the output. It sometimes is interesting.

    More soon (tired now)
    Last edited by Bunkermaster; 05-23-2003 at 04:34 AM.

    "Our ASP will blot out the sun!"
    "Then we will PHP in the shade"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •