Maybe I need to read the copy of php pocket reference I have to David - LOL.
Keith On Sun, 12 Mar 2006 [EMAIL PROTECTED] wrote: > To: mysql@lists.mysql.com > From: [EMAIL PROTECTED] > Subject: Re: Checking for good update > > > looks a bit strange to me. > > > $result = mysql_query($query) or die('Query couldn\'t > > executed:'.mysql_error()); > > please try something like this: > > // build the query - (that's OK) > $query = "UPDATE members SET email_verified='X' WHERE > logon_id='" .$logonid. "'"; > > // send the query to the server - save the result resource > $res = mysql_query($query); > > // test for the result of the above query > if(!$res) > { > // stop the script if the result is not valid > die('Query couldn\'t be executed:'.mysql_error()); > } > > // process a valid result > $row = mysql_fetch_array($res) > > if (mysql_num_rows($res) == 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"); > } > > I've not tested this - but it looks like you are mixing sending the > mysql query and testing for the result of the query at the same time, > which AFAIK is not possible. > > Maybe you need to get a simple introductory book on php, such as O'reillys > php pocket reference, ISBN 0596-00402-8. > > Regards > > Keith > > In theory, theory and practice are the same; > In practice they are not. > > On Sun, 12 Mar 2006, fbsd_user wrote: > > > To: Mysql <mysql@lists.mysql.com> > > From: fbsd_user <[EMAIL PROTECTED]> > > 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 > > Probably because you are not sending a valid query to the server, > you will not be getting a valid result resource back from the server. > > > 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]