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 : error_log -- send an error message somewhere
Categories : PHP, PHP Functions, Errors and Logging Update Picture
documentation group PHP
Date : Apr 24th 1999
Grade : Be the 1st to grade this Code Example
Viewed : 2514
File : No file for this code example.
Images : No Images for this code example.
Search : More code by documentation group PHP
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

Description

Description

</H2
><DIV
CLASS="funcsynopsis"
><A
NAME="AEN11630"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="function"
>error_log</B
></CODE
> (string message, int message_type [, string
destination [, string
extra_headers]])</CODE
></P
><P
></P
></DIV
><P
>&#13; Sends an error message to the web server's error log, a
<SPAN
CLASS="acronym"
>TCP</SPAN
> port or to a file. The first parameter,
<TT
CLASS="parameter"
><I
>message</I
></TT
>, is the error message that should
be logged. The second parameter,
<TT
CLASS="parameter"
><I
>message_type</I
></TT
> says where the message should
go:
<DIV
CLASS="table"
><A
NAME="AEN11648"
></A
><P
><B
>Table 1. <B
CLASS="function"
>error_log()</B
> log types</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>0</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13; <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent to PHP's system
logger, using the Operating System's system logging
mechanism or a file, depending on what the <A
HREF="get_example.php3?Function=configuration#ini.error-log"
>error_log</A
> configuration
directive is set to.
</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>1</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13; <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent by email to the
address in the <TT
CLASS="parameter"
><I
>destination</I
></TT
> parameter.
This is the only message type where the fourth parameter,
<TT
CLASS="parameter"
><I
>extra_headers</I
></TT
> is used. This message
type uses the same internal function as
<B
CLASS="function"
>Mail()</B
> does.
</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>2</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13; <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent through the PHP debugging
connection. This option is only available if <A
HREF="get_example.php3?Function=install.configure#install.configure.enable-debugger"
>remote debugging has
been enabled</A
>. In this case, the
<TT
CLASS="parameter"
><I
>destination</I
></TT
> parameter specifies the host
name or IP address and optionally, port number, of the socket
receiving the debug information.
</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>3</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13; <TT
CLASS="parameter"
><I
>message</I
></TT
> is appended to the file
<TT
CLASS="parameter"
><I
>destination</I
></TT
>.
</TD
></TR
></TBODY
></TABLE
></DIV
>
</P
><P
>&#13; <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN11677"
></A
><P
><B
>Example 1. <B
CLASS="function"
>error_log()</B
> examples</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>&#13;// Send notification through the server log if we can not
// connect to the database.
if (!Ora_Logon ($username, $password)) {
error_log ("Oracle database not available!", 0);
}

// Notify administrator by email if we run out of FOO
if (!($foo = allocate_new_foo()) {
error_log ("Big trouble, we're all out of FOOs!", 1,
"operator@mydomain.com");
}

// other ways of calling error_log():
error_log ("You messed up!", 2, "127.0.0.1:7000");
error_log ("You messed up!", 2, "loghost");
error_log ("You messed up!", 3, "/var/tmp/my-errors.log");
</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
</P
></DIV
>




DB Connection Function with error handling and email failure notices
Categories : PHP, MySQL, Errors and Logging, Databases, Errors and Logging
A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors
Categories : PHP, Variables, Errors and Logging
Logging 404 errors in your custom statistics using Apache and a PHP script.
Categories : Apache, Web Servers, PHP, Errors and Logging
Visits-tracking
Categories : PHP, Databases, MySQL, Errors and Logging, Functions
Error mailing logging facility
Categories : PHP, Errors and Logging, Email
Ping a Server and run a command to fix it if it is down
Categories : PHP, Errors and Logging, Regexps
A Custom Error Handling And Debugging Class
Categories : PHP, PHP Classes, Debugging, Errors and Logging
Building a basic error handler with custom error types
Categories : PHP, PHP Classes, Errors and Logging
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Example of function to send out email if error occurs
Categories : PHP, Email, Debugging, Errors and Logging
[PHP5] PHP Debugger and Helper
Categories : PHP, PHP Classes, Errors and Logging, Debugging, XML
error_reporting -- set which PHP errors are reported
Categories : PHP, PHP Functions, Errors and Logging
Intelligent 404 Handler
Categories : PHP, Errors and Logging
Retrieve text from table and email to your e- address in pipe delimited format.
Categories : PHP, MySQL
Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs.
Categories : Databases, PHP, MySQL, Complete Programs