By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,101 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

on error

P: n/a
Hi alt all
$connection = mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
mysql_select_db("11111111_1")
$query = "SELECT from where...............
in any of these 3 steeps it can make error or any visitor can try to call a
different database or make irs own query
what can I do To be sure that on error in any of these 3 seep the PHP code
self call a certain page?
Thank you in advance and regards
May 18 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Robertu wrote:
Hi alt all
Hi Robertu,
$connection = mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
mysql_connect returns a value.
Check at www.php.net for details.

In this case FALSE is returned if the mysql_connect fails.
So you'll end up with something like this:
$connection = @mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
if ($connection === FALSE){
echo "problem connecting...";
exit;
}

2 notes:
- The @ supresses a possible errormessage.
- the === is NOT a typo.
mysql_select_db("11111111_1")
Also, check www.php.net for returnvalues.
$query = "SELECT from where...............
This will probably not produce an error since you only construct the string.
But when you execute it you can get an error.
Also, check the returnvalue here too.

Good luck!

Regards,
Erwin Moller
in any of these 3 steeps it can make error or any visitor can try to call
a different database or make irs own query
what can I do To be sure that on error in any of these 3 seep the PHP code
self call a certain page?
Thank you in advance and regards
May 18 '07 #2

P: n/a
On May 18, 5:14 pm, Erwin Moller
<since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
Robertu wrote:
Hi alt all

Hi Robertu,
$connection = mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");

mysql_connect returns a value.
Check atwww.php.netfor details.

In this case FALSE is returned if the mysql_connect fails.
So you'll end up with something like this:
$connection = @mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
if ($connection === FALSE){
echo "problem connecting...";
exit;

}

2 notes:
- The @ supresses a possible errormessage.
- the === is NOT a typo.
mysql_select_db("11111111_1")

Also, checkwww.php.netfor returnvalues.
$query = "SELECT from where...............

This will probably not produce an error since you only construct the string.
But when you execute it you can get an error.
Also, check the returnvalue here too.

Good luck!

Regards,
Erwin Moller
in any of these 3 steeps it can make error or any visitor can try to call
a different database or make irs own query
what can I do To be sure that on error in any of these 3 seep the PHP code
self call a certain page?
Thank you in advance and regards
Nothing to add :)

May 18 '07 #3

P: n/a
"Erwin Moller"
WROTE:
Hi Robertu,
>$connection = mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");

mysql_connect returns a value.
Check at www.php.net for details.

In this case FALSE is returned if the mysql_connect fails.
So you'll end up with something like this:
$connection = @mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
if ($connection === FALSE){
echo "problem connecting...";
exit;
}
Hi Erwin and tank you very much
NOW I wrote
$connection = @mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
if ($connection === FALSE)
{
header("www.pippo.es/");
exit();
}

can it work?

I tryed also:
$connection = @mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
if ($connection === FALSE)
{
out();
}

function out()
{
header("www.pippo.it/");
exit();}

Thank you in advance and best regards
May 19 '07 #4

P: n/a
At Sat, 19 May 2007 07:19:18 +0000, Robertu let his monkeys type:
"Erwin Moller"
WROTE:
>Hi Robertu,
>>$connection = mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");

mysql_connect returns a value.
Check at www.php.net for details.

In this case FALSE is returned if the mysql_connect fails.
So you'll end up with something like this:
$connection = @mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
if ($connection === FALSE){
echo "problem connecting...";
exit;
}

Hi Erwin and tank you very much
NOW I wrote
$connection = @mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD");
if ($connection === FALSE)
{
header("www.pippo.es/");
exit();
}

can it work?
Use header('Location:http://www.pippo.es');

And make sure there is NO output by your script before sending the
custom header, as that will cause a header to be already sent.

HTH
Sh.
May 19 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.