mysql_error() returning nothing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have been having this problem for a long time.  A while ago I wrote
the below functions to handle database errors.  They used to display the
message and email it to me.  Now mysql_error() returns nothing!

Any help would be greatly appreciated, as you can imagine this is
causing a lot of problems.

Are they any other ways of getting the error?

Ben

  function query_db( $sql, $db ) {
    $result = mysql_query( $sql, $db ) or
      error_db( $sql, $db );
    return $result;
  }

  function error_db( $sql, $db ) {

      global $SERVER_NAME, $SCRIPT_NAME;

      table_top( "Database Error" );

      table_middle();

      $sqlerr = mysql_error( $db );

      echo "<b>SQL:</b>:<BR>$sql<br><b>Error:</b><BR>$sqlerr";

      table_bottom();

      // Clost of table/html from calling script
      table_bottom();
      html_footer();

      // Send error via email

      $msg  =
        "Application error has accured on CriticalDistribution
instalation ".
        "on '$SERVER_NAME'. The error message is :-\n\n".
        "SQL:$sql\n\nError:$sqlerr\n\n".
        "This message was ".
        "generated by '$SERVER_NAME/$SCRIPT_NAME'";

      $subj = "CritDist App error from $SERVER_NAME";

      // Hard coded to minimize chance of this module erroring
      $to   = "CriticalDistribution <ben@videonetwork.org>";
      $from = "From: ".$to;

      mail($to, $subj, $msg, $from);

      die();
  }


-- 
****************************************************************
* Ben Edwards           Tel +44 (0)1179 553 551  ICQ 42000477  *
* Homepage - nothing of interest here   http://gurtlush.org.uk *
* Webhosting for the masses         http://www.serverone.co.uk *
* Critical Site Builder    http://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video      http://www.videonetwork.org *
* Fun corporate graphics             http://www.subvertise.org *
* Bristol Indymedia               http://bristol.indymedia.org *
* Bristol's radical news             http://www.bristle.org.uk *
****************************************************************

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux