Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

beginning and end of field

Status
Not open for further replies.

Garabaldi

Technical User
Jan 16, 2002
61
0
0
CA
Hi,

My question is this:

In ASP I can check if the result of an sql query produces any records through an if statement ( ex: if object.BOF or object.EOF then
'do nothing
end if
)

Is there anyway to accomplish the results through PHP?

thanks
 
It depends what backend server you use for the database.

Here's the answer for MySQL:
Code:
# get the resource identifier
$result = mysql_query("SELECT * FROM mytable WHERE 1") OR die(mysql_error());

# check how many rows and do something if none
if (mysql_num_rows($result)<1){
   # whatever happens if no result
} else {
   # other handling etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top