RE: [PHP-DB] Question: For no results

2004-12-03 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> And, by the way, why on earth are you using a
> print_r an a straight literal
> string?  Seems to me you could just put that text in
> as part of the HTML:
> 
>if ($row_rsCS == false) {
>?>
>  No Matches
> Found
>  exit;
>}
> 
e...cause I have no idea what i'm doing :)
Not to be funny though, I'm at this 4 months , with no
previous experience with php, any database and html.  
I think I'm slowly catching on.  Code is no longer a
fuzzy mess of characters when I look at it.

Stuart

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 15:26, Stuart Felenstein wrote:

> --- "Ford, Mike" <[EMAIL PROTECTED]> wrote:
> 
> > Well, your taste seems to be to use { }, so :-endif is irrelevant.
> > 
> Alright it's Friday, I'm punchy but we're all in a
> good mood !
> 
> Yes, I like the closing curlies
> 
> So, then where do these lovely ladies go here ?
> 
> if ($row_rsCS == false) {
> 
>  exit;
> }

And, by the way, why on earth are you using a print_r an a straight literal
string?  Seems to me you could just put that text in as part of the HTML:

   if ($row_rsCS == false) {
   ?>
 No Matches Found
   http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 15:26, Stuart Felenstein wrote:

> --- "Ford, Mike" <[EMAIL PROTECTED]> wrote:
> 
> > Well, your taste seems to be to use { }, so :-endif is irrelevant.
> > 
> Alright it's Friday, I'm punchy but we're all in a
> good mood !
> 
> Yes, I like the closing curlies
> 
> So, then where do these lovely ladies go here ?
> 
> if ($row_rsCS == false) {

?>

> 
> 

 exit;
> }

Just put the PHP tags in as indicated and you'll be good to go.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> Well, your taste seems to be to use { }, so :-endif
> is irrelevant.
> 
Alright it's Friday, I'm punchy but we're all in a
good mood !

Yes, I like the closing curlies

So, then where do these lovely ladies go here ?

if ($row_rsCS == false) {
 
exit;
} 

Thank you 
Stuart

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 15:16, Stuart Felenstein wrote:

> --- Stuart Felenstein <[EMAIL PROTECTED]> wrote:
> 
> > The reason the close is there is because the next
> > line
> > of code is the print_r , and I put some html in
> > there.
> > 
> So this works great:
> 
> if ($row_rsCS == false) {
> print_r ("No Matches Found");
> exit;
> }
> 
> But because I want to have some html formatting around
> the print_r, I closed the tags.

Yes, but you didn't include the { } to indicate the scope of the if -- so it
terminated at the ?>.

>  I'm not sure how to use the endif.

Well, your taste seems to be to use { }, so :-endif is irrelevant.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 15:06, Stuart Felenstein wrote:

> > The closing ?> of a PHP segment also implies an
> > end-of-statement semicolon
> > -- so the above is equivalent to:
> > 
> >if ($row_rsCS == false) ;
> > ?> 
> > 
> > Which, of course, means that the scope of the if
> > doesn't extend to anything
> > beyond this point.
> > 
> > You need to mark the block controlled by the if,
> > using either {-} or
> > :-endif, according to your taste.
> > 
> The reason the close is there is because the next line
> of code is the print_r , and I put some html in there.

Nothing wrong with having the closing ?> there -- please re-read my
response.  If it's still unclear to you, please ask specific questions.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Stuart Felenstein

--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:

> The reason the close is there is because the next
> line
> of code is the print_r , and I put some html in
> there.
> 
So this works great: 

if ($row_rsCS == false) {
print_r ("No Matches Found");
exit;
} 

But because I want to have some html formatting around
the print_r, I closed the tags.  I'm not sure how to
use the endif. 

Sutart

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Stuart Felenstein
> The closing ?> of a PHP segment also implies an
> end-of-statement semicolon
> -- so the above is equivalent to:
> 
>if ($row_rsCS == false) ;
>?>
> 
> Which, of course, means that the scope of the if
> doesn't extend to anything
> beyond this point.
> 
> You need to mark the block controlled by the if,
> using either {-} or
> :-endif, according to your taste.
> 
The reason the close is there is because the next line
of code is the print_r , and I put some html in there.


Stuart

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Question: For no results

2004-12-03 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 14:39, Stuart Felenstein wrote:

> I want to send back a message when no matches are
> found on my search page.  Basically "No matches
> found".  I assumed that mysql_fetch_assoc would be the
> determining factor on whether any rows will come back.
>  As you can see below I do a if ($row_rsCS == false).
> Apparently though (while the message is sharp and
> centered ;)), it is not to right place, since it sends
> the message and exits whether records / matches exist or not.   Any
> suggestions ? 
> 
> Thank you
> Stuart
> 
> $query_limit_rsCS = sprintf("%s LIMIT %d, %d",
> $query_rsCS, $startRow_rsCS, $maxRows_rsCS);
> //print_r($query_limit_rsCS);
> $rsCS = mysql_query($query_limit_rsCS, $Pmmodel) or
> die(mysql_error()); //print_r($rsCS);
> $row_rsCS = mysql_fetch_assoc($rsCS);
> 
> if ($row_rsCS == false)
> ?>

The closing ?> of a PHP segment also implies an end-of-statement semicolon
-- so the above is equivalent to:

   if ($row_rsCS == false) ;
   ?>

Which, of course, means that the scope of the if doesn't extend to anything
beyond this point.

You need to mark the block controlled by the if, using either {-} or
:-endif, according to your taste.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Question: For no results

2004-12-03 Thread graeme
You might want to use:
mysql_num_rows  -- Get number of rows in 
result


Stuart Felenstein wrote:
I want to send back a message when no matches are
found on my search page.  Basically "No matches
found".  I assumed that mysql_fetch_assoc would be the
determining factor on whether any rows will come back.
As you can see below I do a if ($row_rsCS == false). 
Apparently though (while the message is sharp and
centered ;)), it is not to right place, since it sends
the message and exits whether records / matches exist
or not.   Any suggestions ?

Thank you 
Stuart

$query_limit_rsCS = sprintf("%s LIMIT %d, %d",
$query_rsCS, $startRow_rsCS, $maxRows_rsCS);
//print_r($query_limit_rsCS);
$rsCS = mysql_query($query_limit_rsCS, $Pmmodel) or
die(mysql_error());
//print_r($rsCS);
$row_rsCS = mysql_fetch_assoc($rsCS);
if ($row_rsCS == false)
?>
 

//print_r($row_rsCS);
if (isset($_GET['totalRows_rsCS'])) {
 $totalRows_rsCS = $_GET['totalRows_rsCS'];
} else {
 $all_rsCS = mysql_query($query_rsCS);
 $totalRows_rsCS = mysql_num_rows($all_rsCS);
}
$totalPages_rsCS =
ceil($totalRows_rsCS/$maxRows_rsCS)-1;