Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MYSQL Error emailing my Cell Phone ??

Status
Not open for further replies.

TheDeaner

Technical User
Oct 13, 2004
11
US
I used this code to have a PHP file email my cell phone and it worked.
------------------------
<?php

mail("9999999999@mobile.att.net", "Header here", "More Text here");

?>
------------------------


My question is does anyone know the code I would need to put into this mysql statement to get it to email my cell phone when there is a mysql error?


$db = mysql_connect("localhost", "name", "mypassword");
mysql_select_db("databasename",$db) or die(mysql_error());


Thanks
Dean
 
Code:
 $db = mysql_connect("localhost", "name", "mypassword");
 if (!mysql_select_db("databasename",$db)){
$err = mysql_error() ;
mail("9999999999@mobile.att.net", "MySQL Error",$err );
  }

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Interesting one this, the manual for die() or exit() says it takes a string or an integer. This implies you can put a function that returns a string. I've tried this under windows (w2k/php 4.3.4) and it works. I would therefor suggest that you write a function with the mail call in and try that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top