Re: Help with displaying rest of page after MySQL error

From: Date: Sat, 17 Mar 2001 03:04:59 +0000
Subject: Re: Help with displaying rest of page after MySQL error
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-7559@lists.php.net to get a copy of this message
""Stuart J. Browne"" <stuart@promed.com.au> wrote in message news:98ujpk$i2j$1@toye.p.sourceforge.net... > > My first line of PHP code (embedded in HTML) has: > > > > $db = mysql_connect("x","y","z") or > > die("saysomethinghere"); > > > > If I have a connection problem, it does print the > > "die" message and the connection error, but it also > > stops the page right there: no more HTML is displayed. > > Well, you've mentioned your problem right here. 'or die ( > "saysomethinghere" );'. Die meaing just that. "Die". Don't > process > anything further. > > > I know about suppressing the error message with "@" > > but this wouldn't seem to help this problem. > > Try something like: > > $db = mysql_connect("X", "Y", "Z"); err dang it.. make that: $db = @mysql_connect("x", "y", "z"); > $db_error = mysql_errno(); > if ($db_error <> 0) { > print "Error conencting to the database"; > $db_error = 1; > } else { > # Do the rest of your MySQL Queries etc. here > # or do checks to make sure $db_error is 0 prior > # to doing any... > } > > hope this helps, or atleast points you in the right direction for > resolution. bkx

« previous php.db (#7559) next »