PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: HELP:Control of A select!!!!!
Date: Mar 3 1999 7:57PM

Sofienne bahri writes:
 > Hello,
 > 
 > I"M using sybperl to develop a web database application. I send a query
 > to the database and i want to give back to the user a window telling him
 > that there is no result( in the case of no data to fecth)  how can i
 > handle this.

You could do something like this:

$found = 0;
while($dbh->ct_results($restype) == CS_SUCCEED) {
   next unless $dbh->ct_fetchable($restype);
   while(@data = $dbh->ct_fetch) {
      ++$found;
      # print out the @data array (maybe in a table?)
   }
}
if(!$found) {
    print "

No data found!

\n"; } This might not be the best way, but maybe it'll give you some ideas. Michael -- Michael Peppler -||- Data Migrations Inc. mpeppler@mbay.net -||- http://www.mbay.net/~mpeppler Int. Sybase User Group -||- http://www.isug.com Sybase on Linux mailing list: ase-linux-list@isug.com