View / Download this file.
--------------------------------------------------
PTMDB MODULE - db_update_row_hash_where() FUNCTION
--------------------------------------------------
------------
USAGE FORMAT
------------
Where $ret is a return value of 1 or 0 (zero):
$ret = &db_update_row_hash_where($db_object, $table, $where,
\%column_value_pairs);
$ret = &db_update_row_hash_where($db_object, $table, $where,
{$col1=>$val1, $col2=>$val2});
-----------
DESCRIPTION
-----------
Updates a given database table rowusing a WHERE comparison statement.
The intended use of this function is to allow updating a row with only
certain column fields filled in without having to define every field.
Returns 1 if successful
Returns 0 (zero) if not successful
---------
ARGUMENTS
---------
$db_object
REQUIRED
A database handler object. This object stores connection information and
is returned from a db_connect() function call. This object is of the same
type as is returned by a DBI->connect function call.
$table
REQUIRED
The name of the table in which you would like to update row information.
$where
REQUIRED
Any SQL "WHERE" statement to be used as part of the "UPDATE" statement.
e.g. "((`column1` = 'value1') AND (`column2` = 'value2'))"
\%column_value_pairs
REQUIRED
A hash reference containing the reqested field column => value quantifier
pairs. This may be either a direct hash reference or an inline Perl hash
reference defined in {$column => $value} format.
-------
RETURNS
-------
1 if row was updated successfully
0 (zero) if row was not updated successfully or no row matches were found.
--------------
USAGE EXAMPLES
--------------
--------------------------------------------------------
Example 1: Update 'name' in a Row with a WHERE statement
--------------------------------------------------------
<?
$ret = &db_update_row_hash_where($dbobj, 'MyTable',
"((`id` = '10') AND (`name` LIKE 'j%'))",
{'name'=>'John'});
?>
--------
SEE ALSO
--------
MODULES
PTMDB
FUNCTIONS
PTMDB - db_connect()
PTMDB - db_update_row_hash()
PTMDB - db_update_row_hash_like()
PTMDB - db_update_row_where()
|