SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    *********! *********!!! jackli's Avatar
    Join Date
    Sep 2005
    Posts
    436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Logging MySQL Error's...

    Earlier in this forum, someone mentioned that all mysql_error()'s should be logged. So, I have a very simple question relating to that:

    Should the errors be logged to a text file (rather than as a row in a mysql table )? What if the text file becomes incredibly large, in a short period of time? When will read/write errors occur, in that case?

  2. #2
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  3. #3
    *********! *********!!! jackli's Avatar
    Join Date
    Sep 2005
    Posts
    436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm a student working on a shared server. don't have the luxury of specifying *mysql.err logs

  4. #4
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    well, i haven't done this before but the obvious way to do it would be, after every mysql query:
    PHP Code:
    if(!mysql_num_rows($query)){
    $errlog fopen("/logs/mysql_error.txt"a);
    fwrite($errlog"\n".date("r").": ".mysql_error())
    fclose($errlog);

    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  5. #5
    SitePoint Evangelist superuser2's Avatar
    Join Date
    Aug 2006
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.phpfreaks.com/tutorials/117/0.php

    There's a tutorial on creating an error handling class.


Bookmarks

Posting Permissions

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