本文整理汇总了PHP中data::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP data::insert方法的具体用法?PHP data::insert怎么用?PHP data::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data
的用法示例。
在下文中一共展示了data::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
function insert()
{
if (isset($_POST)) {
foreach ($_POST as $index => $valeur) {
$donnees[$index] = $valeur;
}
}
$data = new data();
$data->insert($donnees);
}
示例2: get_type
public static function get_type($type)
{
if (array_key_exists($type, self::$types)) {
return self::$types[$type];
} else {
$t = data::fetch('*', 'logs_tipos', 'tipo = "' . $type . '"');
if (isset($t->id)) {
self::$types[$type] = $t->id;
return $t->id;
} else {
$id = data::insert('logs_tipos', 'tipo', '"' . $type . '"');
self::$types[$type] = $id;
return $id;
}
}
}
示例3: insert
public function insert(array $fieldsValues)
{
$fields = array();
$values = array();
$this->fieldsValuesArray($fieldsValues, $fields, $values);
return data::insert($this->tableName, $fields, $values);
}
示例4: createComponentFromTable
public function createComponentFromTable($tableName)
{
$return = NULL;
$count = data::select('COUNT(*) AS TOTAL', $tableName, NULL, NULL, 1) or $return = false;
$count = $count->fetch();
if ($count['TOTAL'] == 0) {
data::insert($tableName, array('id'), array(1));
}
//TODO: Fix ID for primary key.
$result = data::select('*', $tableName, NULL, NULL, 1) or $return = false;
if ($return === false) {
return false;
}
$total = $result->columnCount();
$fields = array();
for ($x = 0; $x < $total; $x++) {
$meta = $result->getColumnMeta($x);
//var_export($meta); echo "------------------<br />\n";
$type = in_array('primary_key', $meta['flags']) ? 'id' : $this->getTypeFromMeta($meta, $tableName, $meta['name']);
array_push($fields, new Field($meta['name'], $type));
}
if ($count['TOTAL'] == 0) {
data::delete($tableName);
}
$newComponent = new cmp_interface($tableName, new fieldSet($fields));
$newComponent->name = $tableName;
return $newComponent;
}
示例5: insert
public function insert(array $valuesArray)
{
$valuesArray = data::escape($valuesArray);
$fields = '';
$values = '';
foreach ($valuesArray as $k => $v) {
if (array_key_exists($k, $this->fields)) {
$fields .= '`' . $k . "`, ";
$values .= "'" . $v . "', ";
} else {
die("<br /><b>ERROR:</b> field <i>\"{$k}\"</i> is not part of <i>\"{$this->name}\"</i><br />");
}
}
$fields = substr($fields, 0, -2);
$values = substr($values, 0, -2);
return data::insert($this->table, $fields, $values);
}