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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What Val would Return if Select Criteria not Met?

Status
Not open for further replies.

M626

Programmer
Mar 13, 2002
299
I am doing this select statement in perl, what VAL would it return if one of the criteria is not met.

select
Client,Received_Date
from
Test_History
where
Client = '$clt_brk' and Received_Date = '$dte_brk'
 
I don't use perl, but PHP has a function called "mysql_num_rows" that returns the number of rows returned. So, I just check to see if that value is 0 and if it is, I alter my output accordingly. Hopefully that'll get you in the right direction.
 
The function to send the query does not return the values. If the query is well-formed and syntactically valid in the context in which you've used it, then MySQL will return a handle to the data.

It's most like a file handle than anything, except there are specialized functions for retrieving the data from that handle.

If the handle returned is not null, the perl DBI should provide a method to the statement handle called "numrows":

$sth = $dbh->query('SELECT....');
print $sth->numrows;

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top