Re: how to tell if a returned returned query has results,

From: Date: Fri, 23 Jun 2000 17:17:02 +0000
Subject: Re: how to tell if a returned returned query has results,
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2829@lists.php.net to get a copy of this message
Here is a snippet of code that I use to accomplish what you've asked about... global $hostname, $user, $password ; $sqlcmd = "SELECT * FROM notes WHERE notes.Ticket_ID = ".$ticketnbr." ORDER BY notes.Ticket_ID, notes.Sequence" ; $db = mysql_connect($hosthame,$user,$password) ; $rs = mysql_db_query("tb_dbms", $sqlcmd, $db) ; if ($rs == "") { echo "An unexpected SQL error occurred while " ; echo "trying to retrieve the Notes table values.<BR><BR>" ; echo "Debug Information<BR><BR>" ; echo mysql_errno().": ".mysql_error()."<BR><BR>" ; echo "rc = ".$rc."<BR>" ; echo "sqlcmd = ".$sqlcmd."<BR>" ; } else $rowcount = mysql_num_rows($rs) ; if ($rowcount > 0) { etc...etc...etc... Cheers, Brett <david.tansley@acelondon.co.uk> wrote in message news:80256907.005D08CC.00@acelondon.co.uk... > > > Hello, > > Apart from seeing the screen output, how can you test that the > returned results from a query (mysql) does not have any rows, so you > can inform inform the user with a friendly message, saying "... > the search to not return any results".. > > Thanks > > D.T. > ________________________________________________________________________ > > CONFIDENTIALITY This e-mail and any attachments are confidential and may > also be privileged. If you are not the intended recipient(s) please note > that any distribution, copying or use of this communication or the > information in it is strictly prohibited.If you are not the named > recipient(s), please notify the sender immediately and do not disclose > the contents to another person, use it for any purpose, or store or > copy the information in any medium. > > > > ************ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#2829) next »