$result didn't work as it should

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
victor
Forum Commoner
Posts: 65
Joined: Fri Feb 13, 2004 1:36 am

$result didn't work as it should

Post by victor »

I updated my verify my password using the following

?>
$query = "update user set Password = password('$new_password') where username = '$username'";

$result = @mysql_query($query);

Code: Select all

<?php

when injecting a invalid username, the $results still prints '1' (It should print '0' ), however mysql_affected_rows function returns '0' rows. can someone advise why is this the case.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that's the correct response. the query did not fail, it updated zero rows.
Post Reply