All ready read that and its clear as mud.
It tells you update is different but gives no example.

I asked in my post what should I code for checking the result of a
update.



-----Original Message-----
From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 12, 2006 4:50 PM
To: [EMAIL PROTECTED]; Mysql
Subject: RE: Checking for good update


Perhaps reading the manual would be a good start at
http://us3.php.net/manual/en/function.mysql-num-rows.php

It clearly states

Retrieves the number of rows from a result set. This command is only
valid for SELECT statements. To retrieve the number of rows affected
by
a INSERT, UPDATE, or DELETE query, use mysql_affected_rows().

You are using a function not valid for an UPDATE

Regards

---------------------------------------------------------------
********** _/     **********  David Logan
*******   _/         *******  ITO Delivery Specialist - Database
*****    _/            *****  Hewlett-Packard Australia Ltd
****    _/_/_/  _/_/_/  ****  E-Mail: [EMAIL PROTECTED]
****   _/  _/  _/  _/   ****  Desk:   +618 8408 4273
****  _/  _/  _/_/_/    ****  Mobile: 0417 268 665
*****        _/       ******
******      _/      ********  Postal: 148 Frome Street,
********   _/     **********          Adelaide SA 5001
                                      Australia
i    n    v    e    n    t
---------------------------------------------------------------

-----Original Message-----
From: fbsd_user [mailto:[EMAIL PROTECTED]
Sent: Monday, 13 March 2006 8:00 AM
To: Mysql
Subject: Checking for good update

Using this code I get this error message.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /usr/local/www/data/mls_verifyemail.php on line
49

What code should I use to check if the update worked or not?


$query = "UPDATE members SET email_verified='X' WHERE
logon_id='".$logonid."'";

$result = mysql_query($query) or die('Query couldn\'t
executed:'.mysql_error());

if (mysql_num_rows($result) == 1)
    {
         // the user id and password match,
         print("User id on db");
        }
        else
        {
         //$errorMessage = 'Sorry, wrong user id / password';
         print("Sorry, wrong user id / password");

        }


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to