ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
inc.meta_data_converter.php File Reference

Go to the source code of this file.

Functions

 ilMDConvert ($table, $fields, $key)

Function Documentation

ilMDConvert (   $table,
  $fields,
  $key 
)

Definition at line 3 of file inc.meta_data_converter.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and ilUtil\quoteArray().

{
global $ilDB;
$where = "WHERE ";
$where .= implode(" LIKE '%\%' ESCAPE '�' OR ", ilUtil::quoteArray($fields));
$where .= " LIKE '%\\%' ESCAPE '�'";
$query = "SELECT * FROM ".$table." ".
$where;
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$query = "UPDATE $table ";
$counter = 0;
foreach($fields as $field)
{
if($counter++)
$query .= ", ";
else
$query .= "SET ";
$query .= ($field ." = ".$ilDB->quote(stripslashes($row->$field))." ");
}
$query .= (" WHERE ".$key." = ".$ilDB->quote($row->$key));
// Perform the query
$ilDB->query($query);
}
}

+ Here is the call graph for this function: