SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict nodding dino's Avatar
    Join Date
    May 2003
    Location
    London
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    query returns no rows...

    this one has me stumped...

    i am writing a 'ticketing' module for my intranet, which allows users to log fault calls directly onto a mysql database. The IT staff then have access to an 'admin' page which searches for open calls by a number of different criteria.

    so far, so good...

    one of my search options is based on calls by assigned user, for example allowing our techie to look at his calls and our as400 operator to look at hers. i have an if statement that warns the user that the name searched for doesn't exist my using the mysql_num_rows command which works fine BUT...

    i cannot seem to be able to work out how to differentiate between the situation outlined above, and when a username exists but doesn't have any open calls (not that that will happen much here!!!) the code works fine, it just doesn't display anything at all...i would like to print a 'You have no open calls currently assigned' message.

    so, after all of that background, my question...i need to do something like this (and would like you guys to fill in the gaps!)

    PHP Code:
    if (!rows){
    echo
    'the name does not exist in the database';
    }elseif{
    echo
    'You do not currently have any assigned calls';
    }else{
    echo
    'here are your open calls';

    it's the middle if statement that i can't seem to get my head around...ANY IDEAS?!?!?!

  2. #2
    SitePoint Addict nodding dino's Avatar
    Join Date
    May 2003
    Location
    London
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK i admit it - i'm a chump. Can someone please change my status from Enthusiast to numpty.

    just added another check rows on the second query (the one that checks for assigned calls), it works peachy.

    why does everything seem so much more difficult when the suns out...?

  3. #3
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if (!rows){

    should be:

    if (!$rows){

    shouldn't it?

  4. #4
    SitePoint Addict nodding dino's Avatar
    Join Date
    May 2003
    Location
    London
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah - sorry, not a copy of the actual code, just a quick (poorly typed) example to give you the idea...!

  5. #5
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by nodding dino
    why does everything seem so much more difficult when the suns out...?
    Heh, I know that feeling. "Why are we stuck inside on the few days of sunshine we actually get?".
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •