Re: error for mysql
| From: | Kurth Bemis | Date: | Wed, 11 Oct 2000 02:56:48 +0000 |
| Subject: | Re: error for mysql | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19475@lists.php.net to get a copy of this message | ||
At 12:54 PM 10/11/2000 +1030, David Robley wrote:
ok then....thats doable...how would i make the error then?
~kurth
On Wed, 11 Oct 2000, Kurth Bemis wrote: hey all have a feature that i'd like to add into scripts that querry a mysql table. i want to have it display a message like - cannot access database at this time. please retry later. or something like that... i have a snippet...and am wondering how to integrate it with my existing code..... function error ($err) {Kurth Bemis - Network/Systems Administrator, USAExpress.net/Ozone Computer kurth@usaexpress.net http://www.usaexpress.net/kurth ICQ - 6624050 Call Sign - N1TYW PGP key available - http://www.usaexpress.net/kurth/pgp Fight Weak Encryption! Donate your wasted CPU cycles to Distributed.net (http://www.distributed.net)echo "<h1>$err</h1><hr>";} script in here..$fp = @fopen($file,"r"); if(!$fp) { print_error("Cannot open file: $file"); break; }How would i integrate that with this - $titleresult= mysql_query("SELECT * from validtables WHERE dbtables = '$data'",$db); // sql query to get title and message info from db while ($myrow = @mysql_fetch_array($titleresult)) { // get the data from the query and put it into vars$title = $myrow["title"]; $message1 = $myrow["message1"]; $message2 = $myrow["message2"]; $message3 = $myrow["message3"]; }any ideas? You would probably be better off attempting a database connection and returning an error message if that failed. Attempting to open a file will not tell you anything about the availability of a connection to mysql. --David Robley | WEBMASTER & Mail List AdminRESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA