Professional Web Applications Themes

mysql_num_rows - MySQL

Hi, why returns the following code the error right below? PHP Code: $tempQuery  =  mysql_query ( "SELECT ID FROM security_images WHERE referenceid='" . $referenceid . "' AND hiddentext='" . $enteredvalue . "'" ); if ( mysql_num_rows ( $tempQuery )!= 0 ) { return  true ; } else { return  false ; }  [error] Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /opt/lampp/htdocs/paykiosks/test/Signupdemo.php on line 16 [/error] I can't see the problem... Thank you very much! -- chEErs roN I'm root, I'm allowed to do this! ;) keep on rockin'...

  1. #1

    Default mysql_num_rows

    Hi, why returns the following code the error right below?
    PHP Code:
    $tempQuery mysql_query("SELECT ID FROM security_images WHERE
    referenceid='"
    .$referenceid."' AND hiddentext='".$enteredvalue."'");
    if (
    mysql_num_rows($tempQuery)!=0) {
    return 
    true;
    } else {
    return 
    false;

    [error]
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
    resource in /opt/lampp/htdocs/paykiosks/test/Signupdemo.php on line 16
    [/error]
    I can't see the problem... Thank you very much!
    --
    chEErs roN

    I'm root, I'm allowed to do this! ;)
    keep on rockin'
    roN Guest

  2. #2

    Default Re: mysql_num_rows

    "roN" <NOspamexample.com> wrote in message
    news:4740qvFai0i1U1individual.net...
    > Hi, why returns the following code the error right below?
    > [php]
    > $tempQuery = mysql_query("SELECT ID FROM security_images WHERE
    > referenceid='".$referenceid."' AND hiddentext='".$enteredvalue."'");
    What are the values $referenceid and $enteredvalue?
    Are you sure the resulting SQL is correct and it is being pd and
    prepared without errors?
    You should check the result of mysql_query with something like:

    if (!$tempQuery) {
    die('Error in SQL query: ' . mysql_error());
    }

    Also, you should form the SQL query as a string variable prior to using it
    in mysql_query(). Then you can output the final statement as a debugging
    check. Or even copy & paste the string into the mysql CLI to test it.
    Forming a SQL statement dynamically as you are doing and immediately
    executing it is a good way to obscure errors.

    Regards,
    Bill K.


    Bill Karwin Guest

  3. #3

    Default Re: mysql_num_rows

    roN wrote:
    > Hi, why returns the following code the error right below?
    >
    PHP Code:
    >    $tempQuery mysql_query("SELECT ID FROM security_images WHERE
    >    referenceid='"
    .$referenceid."' AND hiddentext='".$enteredvalue."'");
    >    if (
    mysql_num_rows($tempQuery)!=0) {
    >       return 
    true;
    >    } else {
    >       return 
    false;
    >    }

    > [error]
    > Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
    > resource in /opt/lampp/htdocs/paykiosks/test/Signupdemo.php on line 16
    > [/error]
    > I can't see the problem... Thank you very much!
    The problem is you didn't check the results of your mysql_query.

    Find out why your query failed and you'll have your answer.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    [email]jstucklexattglobal.net[/email]
    ==================
    Jerry Stuckle Guest

Similar Threads

  1. Replies: 0
    Last Post: November 10th, 05:55 PM
  2. #26187 [NEW]: mysql_num_rows returns error when empty instead of 0
    By matt at 1lsn dot com in forum PHP Development
    Replies: 0
    Last Post: November 10th, 12:24 AM
  3. mysql_num_rows equivalent for DBI?
    By Ben Giddings in forum Ruby
    Replies: 7
    Last Post: October 12th, 06:17 PM
  4. Replies: 0
    Last Post: September 2nd, 11:53 AM
  5. [PHP] mysql_num_rows
    By John Taylor-Johnston in forum PHP Development
    Replies: 1
    Last Post: August 16th, 01:25 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139