#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    4
    Rep Power
    0
    I am developing a web site that makes use of the mysql php functions to get data from a database. If for some reason any of the calls to the db fails or the database is not available of whatever, i want to direct the user to a generic page saying something like "there was a database error. try again later." I dont want them to see the debugging information with the code that failed. how do i do this?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    30
    Rep Power
    15
    I would suggest doing something like this

    mysql_query($query) or die(DoSomething());

    basically each time you do something database related you could just perform an or die() function, if it fails you could just output your generic error page, or whatever you wanted.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    15
    I think you could also place a header() call inside the die() function that would take the misfotunate user to a pre-made error page.

    Just one thought, though. If you are going to make your own die() function, be sure to set the last command in the function to exit because otherwise the script will continue running...

    [This message has been edited by dwarf (edited July 18, 2000).]

Similar Threads

  1. Building A Generic Error Reporting Class In PHP
    By olliemaitland in forum Development Articles
    Replies: 8
    Last Post: September 12th, 2004, 10:04 AM
  2. a generic ques:PL/SQL
    By aspuser25 in forum Oracle Development
    Replies: 2
    Last Post: January 7th, 2004, 01:54 PM
  3. How do I create a generic form submission function?
    By colpaarm in forum HTML Programming
    Replies: 1
    Last Post: March 3rd, 2003, 12:51 PM
  4. generic form handler
    By damon129 in forum PHP Development
    Replies: 2
    Last Post: February 7th, 2002, 03:14 PM
  5. generic authentication
    By element522 in forum MySQL Help
    Replies: 1
    Last Post: October 21st, 2001, 06:24 AM

IMN logo majestic logo threadwatch logo seochat tools logo