Hi All,
I've created an function for update record in database's table.
the function can handle all the record update from any table... with parameter passed
in .. like this :
function update($table,$values,$condition)
{ $link=$this->database();
$fields = mysql_list_fields("wellindo", $table, $link);
$columns = mysql_num_fields($fields);
$field_values="";
for ($i = 1; $i < $columns-1; $i++) {
$field_values=$field_values.mysql_field_name($fields,
$i)."=".$values[$i].",";}
$field_values=$field_values.mysql_field_name($fields, $i)."=".$values[$i];
$query = "UPDATE $table SET $field_values $condition";
$this->query($query,$table);
}
the function will find all the fields of the table then update all the data.
the problem is that when there ar some fields that I dont want to update (I still want
to use the existed/old data )...
so how do I do that...??
eg : I hav record
name phone country
a 123 England
and i want to update only phone change to 234.... what can do to set name and country
so that it still remain the old data
sorry for the awful explaination....hope someone can get it...
thanx
By regard;
Sukanto