Re: mysql if empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 5:53 PM -0700 4/10/07, Jim Lucas wrote:
Anyways, here is the expanded version hopefully to your liking.


<?php

// do that db connection thing...
// select you database

$sql = "SELECT
		Client
	FROM
		booked
	WHERE
		Name = 'larry'
";

if ( ( $result = mysql_query($sql) ) === false ) {
# Your request failed. Make up your own custom way of displaying the error.
} else {
	if ( mysql_num_rows($results) > 0 ) {
		while ( $row = mysql_fetch_assoc($result) ) {
if ( isset($row['client']) && !empty($row['client']) ) {
				echo $row['client'] . '<br />';
			}
		}
	} else {
		echo 'No results found!';
	}
}
?>

Does this satisfy you?

Actually, it's $result and not $results. Other than that, it works fine as far as I can tell.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux