MySQL Forums
Forum List  »  MyISAM

Re: proper PHP for use w/ "IS NOT NULL"
Posted by: Brian Moon
Date: December 10, 2005 03:03PM

You can't use die() like that. In fact, I don't really like die() all that much. It takes control away from the user.

$query = mysql_query("SELECT en_route, stop_code, stop_name, neighborhood, miles_2next, elapse_2next, mins_2main, near_transfer, fare_free, remarks FROM h_stops WHERE (en_route=".$_POST['stopsel'].") AND (stop_name IS NOT NULL)", $conn);

if($err=mysql_error($conn)){
// you can do anything in here.
// you only need to check for an error here
// if there is not one here, mysql_num_rows
// will not be returning one either.
trigger_error($err, E_USER_ERROR);
}

$rows = mysql_num_rows($query);

if ($rows > 0) {

// do this

} else { // its either greater than 0 or its not.

// do something different

}

Brian Moon
Phorum Dev Team
http://phorum.org/
-----------------------
dealnews.com - How to go broke saving money.
http://dealnews.com/

Options: ReplyQuote


Subject
Views
Written By
Posted
8308
December 10, 2005 02:07PM
Re: proper PHP for use w/ "IS NOT NULL"
3156
December 10, 2005 03:03PM
2112
December 10, 2005 03:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.