what needs to be done with this UPDATE ?

admin

Administrator
Staff member
Hi,

I have the following update query

$sql = "UPDATE aTable SET ";

# set and where conditions goes here

$dblink = mysql_connect($hostname, $user, $passwd)
or die ("Error: No connection to MySQL server\n");

mysql_select_db($dbname,$dblink)
or die ("Error: MySQL database not selected\n");

$res = mysql_query($sql, $dblink)

or die ("SQL query failed: $sql");
if($res !=null)
print(Database is updated)

This query works fine.

If I try to update something which does not exists in the database, it still gives "database updated" message.

I was thinking if it can not update database, it would return null as result of the query($res), apparently it does not work like that.

Any suggestions?
 
Back
Top