> And I have one more question, what is the meaning of 'or'?
> e.g.
> $db=mysql_connect("localhost","root","password") or die ("could not
> connect");

One more thing, which is important to me as a newbie (as I most certainly
am), you can make a custom error message for the die error; which is
important to me seeing as it happens a lot ;)

if you want to see what the error is (for use with MySQL), use

or die (mysql_error());

or use a message which will display nicely to users, if you're re-writing
something which is already online and in use (not recommended).

$error = "<html>\n<head>\n<title>We encountered an
error!</title>\n</head>\n\n";

$error .= "<body bgcolor=\"hex value\" text=\"hex value\">\n";

$error .= "We encountered an error!  Please go back to our <a
href=\"http://www.site.com\">site</a>!\n\n";

$error .= "</body>\n";

$error .= "</html>";

Then, you would use something like:

 $connection = mysql_connect("localhost","username","password")
        or die ($error);

If this is blatantly obvious to you, please ignore it, but at one time not
too long ago, it was helpful to me.  There's probably a lot neater way of
doing things too ;)

James.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to