Re: [PHP] redirect if sql = nothing

2001-02-20 Thread Joe Sheble (Wizaerd)

by checking the return value of mysql_num_rows()

At 04:32 PM 2/20/01 +, Matt Davis wrote:
>If my SQL returns no results then i want to redirect to a page saying no
>results etc but if results are found then I want it to continue on down the
>script how would i do this.
>
>Matt.
>
>
>--
>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]


-- 
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]




RE: [PHP] redirect if sql = nothing

2001-02-20 Thread Brian V Bonini

$sql = "select * from table where bla bla bla";

if(!isset($sql)) {
do this;
} else {
do this;
}

I think ?

-Brian
**

> -Original Message-
> From: Matt Davis [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 20, 2001 11:33 AM
> To: Php Mailing List
> Subject: [PHP] redirect if sql = nothing
> 
> 
> If my SQL returns no results then i want to redirect to a page saying no
> results etc but if results are found then I want it to continue 
> on down the
> script how would i do this.
> 
> Matt.
> 
> 
> -- 
> 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]
> 
> 

-- 
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]




Re: [PHP] redirect if sql = nothing

2001-02-20 Thread Website4S

In a message dated 20/02/2001 16:42:51 GMT Standard Time, 
[EMAIL PROTECTED] writes:

<< $sql = "select * from table where bla bla bla";
 
 if(!isset($sql)) {
do this;
 } else {
do this;
 }
 
 I think ?
 
 -Brian >>

This way might be a little easier

$sql = "select * from table where bla bla bla";
$num_rows = mysql_num_rows($sql);

if ($num_rows==0){
header ("Location: Http://www.YOURURL.com/");
}

Although depending on the rest of your script the header may have already 
been sent in which case it won`t work. 

HTH
Ade

-- 
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]




RE: [PHP] redirect if sql = nothing

2001-02-20 Thread Joe Sheble (Wizaerd)

Actually this won't work since the actual query never runs

try:

$sql = "select * from table where bla bla bla";
$rResults = mysql_query( $sql, $dbConnection );
if( mysql_num_rows($rResults) == 0 ) {
 do this;
} else {
 do this;
}


At 11:52 AM 2/20/01 -0500, Brian V Bonini wrote:
>$sql = "select * from table where bla bla bla";
>
>if(!isset($sql)) {
> do this;
>} else {
> do this;
>}
>
>I think ?
>
>-Brian
>**
>
> > -Original Message-
> > From: Matt Davis [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 20, 2001 11:33 AM
> > To: Php Mailing List
> > Subject: [PHP] redirect if sql = nothing
> >
> >
> > If my SQL returns no results then i want to redirect to a page saying no
> > results etc but if results are found then I want it to continue
> > on down the
> > script how would i do this.
> >
> > Matt.
> >
> >
> > --
> > 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]
> >
> >
>
>--
>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]


-- 
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]




RE: [PHP] redirect if sql = nothing

2001-02-20 Thread Matt Davis

I have put this code in but its not making any difference

 if ($num==0) {
 header("location:
http://www.***/0/cambridgeshire/_shared/database_files/php_files/nor
esults.htm");
 } else {;
 }

Matt.

-Original Message-
From: Joe Sheble (Wizaerd) [mailto:[EMAIL PROTECTED]]
Sent: 20 February 2001 16:46
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Php Mailing List
Subject: RE: [PHP] redirect if sql = nothing


Actually this won't work since the actual query never runs

try:

$sql = "select * from table where bla bla bla";
$rResults = mysql_query( $sql, $dbConnection );
if( mysql_num_rows($rResults) == 0 ) {
 do this;
} else {
 do this;
}


At 11:52 AM 2/20/01 -0500, Brian V Bonini wrote:
>$sql = "select * from table where bla bla bla";
>
>if(!isset($sql)) {
> do this;
>} else {
> do this;
>}
>
>I think ?
>
>-Brian
>**
>
> > -Original Message-
> > From: Matt Davis [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 20, 2001 11:33 AM
> > To: Php Mailing List
> > Subject: [PHP] redirect if sql = nothing
> >
> >
> > If my SQL returns no results then i want to redirect to a page saying no
> > results etc but if results are found then I want it to continue
> > on down the
> > script how would i do this.
> >
> > Matt.
> >
> >
> > --
> > 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]
> >
> >
>
>--
>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]


--
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]


-- 
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]