another simple question.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Trevor Kearsey

    another simple question.

    select from db where id = 3...

    if it doesn't exist, how can i display a message saying so.

    for example:

    "3" is not a valid selection.

    make sense?
    thanks.


  • Shawn Wilson

    #2
    Re: another simple question.

    Trevor Kearsey wrote:[color=blue]
    >
    > select from db where id = 3...
    >
    > if it doesn't exist, how can i display a message saying so.
    >
    > for example:
    >
    > "3" is not a valid selection.[/color]

    $res = mysql_query("se lect from db where id = 3");
    if (!$res)
    echo "ERROR" . mysql_error();
    elseif (mysql_num_rows ($res) == 0)
    echo "No results from search";
    else
    echo "Results were returned from search.";

    Shawn
    --
    Shawn Wilson
    shawn@glassgian t.com

    Comment

    Working...