CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
What is no results found.

 



newbiecoder
Novice

Feb 9, 2003, 7:37 AM

Post #1 of 2 (3419 views)
What is no results found. Can't Post

Hi,
I've been looking through all the dbi documentation, loads of FAQ sites about dbi etc... But none seem to mention what to do when no results are found to your query.

$query = qq(SELECT field1, field2, etc FROM database WHERE email = "$email");

When I run my query, if the record being looked for is found, everything works correctly. However, if the record isn't found, it doesn't display anything.

How can I return a no record found message?

I'm probably being really stupid and missing something obvious but any help is very much appreciated!

Chris


Paul
Enthusiast

Feb 10, 2003, 3:40 AM

Post #2 of 2 (3414 views)
Re: [newbiecoder] What is no results found. [In reply to] Can't Post

We need to see more code than just the query.

However you are fetching the rows then just do an if/else.


Code
my @row = $sth->fetchrow; 

if (scalar @row) {

}
else {

}


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives