本文整理汇总了PHP中MySQL::InsertRow方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::InsertRow方法的具体用法?PHP MySQL::InsertRow怎么用?PHP MySQL::InsertRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::InsertRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addNew
public function addNew($data)
{
$db = new MySQL(true, 'color64', 'localhost', 'color64', 'nu5Jc4JdtZK4RCHH');
$d = array('name' => MySQL::SQLValue(strtoupper(trim($data['u']))), 'password' => MySQL::SQLValue(MD5($data['p'])));
$result = $db->InsertRow('users', $d);
return $result;
}
示例2: insertPaymentMethod
function insertPaymentMethod($data)
{
$db = new MySQL();
$paymentMethod['cdmodalitapagamento'] = MySQL::SQLValue($data[0]);
$paymentMethod['dsmodalitapagamento'] = MySQL::SQLValue($data[1]);
if (!empty($data[2]) && strtolower($data[2]) == "true") {
$paymentMethod['cdvisibilita'] = MySQL::SQLValue(1);
} else {
$paymentMethod['cdvisibilita'] = MySQL::SQLValue(2);
}
if (empty($data[3])) {
$paymentMethod['dssconto'] = MySQL::SQLValue("0");
} else {
$paymentMethod['dssconto'] = MySQL::SQLValue($data[3]);
}
$db->InsertRow("ps_webshop_modpagamento", $paymentMethod);
}
示例3: membership_role_create
/**
* @param $data
* @return bool|int
*/
public function membership_role_create($data)
{
$values = array();
foreach ($data as $key => $value) {
if ($key == 'name') {
$values[$key] = MySQL::SQLValue($value);
} else {
$values[$key] = MySQL::SQLValue($value, MySQL::SQLVALUE_NUMBER);
}
}
$table = $this->kga['server_prefix'] . "membershipRoles";
$result = $this->conn->InsertRow($table, $values);
if (!$result) {
$this->logLastError('membership_role_create');
return false;
}
return $this->conn->GetLastInsertID();
}
示例4: readInfoEcommerce
/**
* Metodo utilizzato per leggere le informazioni da ERP
* e inserirle nella tabella vsecommerce_info
*/
function readInfoEcommerce()
{
$content = $this->file_get_contents_utf8(FOLDER_UNZIP . FILE_INFO . ".txt");
$array_field = explode("\n", $content);
if ($this->checkInsertOrAppend(FILE_INFO) == 0) {
$this->truncateTable("vsecommerce_info");
}
foreach ($array_field as $field_comb) {
$data = explode("§", $field_comb);
if (!$this->checkInfoExists(trim($data[0]))) {
$values['field_name'] = MySQL::SQLValue(trim($data[0]));
$values['value'] = MySQL::SQLValue(trim($data[1]));
$db = new MySQL();
$db->InsertRow("vsecommerce_info", $values);
} else {
$where['field_name'] = MySQL::SQLValue(trim($data[0]));
$values['value'] = MySQL::SQLValue(trim($data[1]));
$db = new MySQL();
$db->UpdateRows("vsecommerce_info", $values, $where);
}
}
}
示例5: content_create_revision
function content_create_revision($id)
{
global $hmcontent;
$hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
hook_action('content_create_revision');
$id = hook_filter('content_create_revision', $id);
$tableName = DB_PREFIX . "content";
$whereArray = array('id' => MySQL::SQLValue($id));
$hmdb->SelectRows($tableName, $whereArray);
if ($hmdb->HasRecords()) {
$row = $hmdb->Row();
$content_key = $row->key;
$values["name"] = MySQL::SQLValue($row->name);
$values["slug"] = MySQL::SQLValue($row->slug);
$values["key"] = MySQL::SQLValue($row->key);
$values["status"] = MySQL::SQLValue('revision');
$values["parent"] = MySQL::SQLValue($row->id);
$insert_revision_id = $hmdb->InsertRow($tableName, $values);
unset($values);
/** lưu field của bản revision content vào database */
$tableName = DB_PREFIX . "field";
$whereArray = array('object_id' => MySQL::SQLValue($id), 'object_type' => MySQL::SQLValue('content'));
$hmdb->SelectRows($tableName, $whereArray);
if ($hmdb->HasRecords()) {
$count = $hmdb->RowCount();
$i = 1;
while ($row = $hmdb->Row()) {
$values[$i]["name"] = MySQL::SQLValue($row->name);
$values[$i]["val"] = MySQL::SQLValue($row->val);
$values[$i]["object_id"] = MySQL::SQLValue($insert_revision_id);
$values[$i]["object_type"] = MySQL::SQLValue('content');
$i++;
}
foreach ($values as $value) {
$hmdb->InsertRow($tableName, $value);
}
}
/** lưu relationship của bản revision content vào database */
$tableName = DB_PREFIX . "relationship";
$whereArray = array('object_id' => MySQL::SQLValue($id));
$hmdb->SelectRows($tableName, $whereArray);
if ($hmdb->HasRecords()) {
$count = $hmdb->RowCount();
$i = 1;
while ($row = $hmdb->Row()) {
$values[$i]["relationship"] = MySQL::SQLValue($row->relationship);
$values[$i]["target_id"] = MySQL::SQLValue($row->target_id);
$values[$i]["object_id"] = MySQL::SQLValue($insert_revision_id);
$i++;
}
foreach ($values as $value) {
$hmdb->InsertRow($tableName, $value);
}
}
return $insert_revision_id;
} else {
return FALSE;
}
}
示例6: taxonomy_ajax_add
function taxonomy_ajax_add($key, $id_update = NULL)
{
global $hmtaxonomy;
$hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
hook_action('taxonomy_ajax_add');
$tax = $hmtaxonomy->hmtaxonomy;
if (isset($tax[$key])) {
$this_tax = $tax[$key];
foreach ($_POST as $post_key => $post_val) {
$primary = $this_tax['taxonomy_field']['primary_name_field']['name'];
/** input này được dùng làm khóa tên chính */
if ($post_key == $primary) {
$tax_name = $post_val;
$parent = hm_post('parent');
if (!is_numeric($parent)) {
$parent = 0;
}
if ($parent == $id_update) {
$parent = 0;
}
if (isset($_POST['slug_of_' . $post_key])) {
if (is_numeric($id_update)) {
$tax_slug = $_POST['slug_of_' . $post_key];
} else {
$tax_slug = add_request_uri_custom($_POST['slug_of_' . $post_key]);
}
} else {
switch ($_POST['accented_of_' . $post_key]) {
case 'true':
if (is_numeric($id_update)) {
$tax_slug = sanitize_title_with_accented($post_val);
} else {
$tax_slug = add_request_uri_with_accented($post_val);
}
break;
case 'false':
if (is_numeric($id_update)) {
$tax_slug = sanitize_title($post_val);
} else {
$tax_slug = add_request_uri($post_val);
}
break;
default:
if (is_numeric($id_update)) {
$tax_slug = sanitize_title($post_val);
} else {
$tax_slug = add_request_uri($post_val);
}
}
}
/** lưu taxonomy vào data base */
$tableName = DB_PREFIX . 'taxonomy';
$values["name"] = MySQL::SQLValue($tax_name);
$values["slug"] = MySQL::SQLValue($tax_slug);
$values["key"] = MySQL::SQLValue($key);
$values["parent"] = MySQL::SQLValue($parent);
$values["status"] = MySQL::SQLValue('public');
if (is_numeric($id_update)) {
unset($values["status"]);
$whereArray = array('id' => $id_update);
$hmdb->AutoInsertUpdate($tableName, $values, $whereArray);
$insert_id = $id_update;
up_date_request_uri_object($tax_slug, $insert_id, 'taxonomy', 'has_object');
} else {
$insert_id = $hmdb->InsertRow($tableName, $values);
up_date_request_uri_object($tax_slug, $insert_id, 'taxonomy', 'null_object');
}
$latest_array = array('id' => $insert_id, 'name' => $tax_name, 'slug' => $tax_slug, 'key' => $key, 'parent' => $parent);
unset($values);
}
}
foreach ($_POST as $post_key => $post_val) {
/** lưu taxonomy field vào data */
if (is_numeric($insert_id)) {
$tableName = DB_PREFIX . 'field';
$values["name"] = MySQL::SQLValue($post_key);
$values["val"] = MySQL::SQLValue($post_val);
$values["object_id"] = MySQL::SQLValue($insert_id, MySQL::SQLVALUE_NUMBER);
$values["object_type"] = MySQL::SQLValue('taxonomy');
if (is_numeric($id_update)) {
$whereArray = array('object_id' => MySQL::SQLValue($id_update, MySQL::SQLVALUE_NUMBER), 'object_type' => MySQL::SQLValue('taxonomy'), 'name' => MySQL::SQLValue($post_key));
$hmdb->AutoInsertUpdate($tableName, $values, $whereArray);
} else {
$hmdb->InsertRow($tableName, $values);
}
unset($values);
}
}
/** show table */
$status = hm_get('status', 'public');
$perpage = hm_get('perpage', '30');
$return_array = taxonomy_show_data($key, $status, $perpage, false);
$return_array['latest'] = $latest_array;
return json_encode($return_array, true);
}
}
示例7: insertTipoEffettoScadenza
function insertTipoEffettoScadenza($data)
{
$db = new MySQL();
$tipoEff['id_tpe'] = MySQL::SQLValue($data[0]);
$tipoEff['ds_tpe'] = MySQL::SQLValue($data[1]);
$db->InsertRow("vs_tsa_tipoeff", $tipoEff);
}
示例8: add
public function add($data)
{
$db = new MySQL(true, 'color64', 'localhost', 'color64', 'nu5Jc4JdtZK4RCHH');
$result = $db->InsertRow('log', $data);
return $result;
}
示例9: ajax_add_user
/** Load template user box */
function ajax_add_user($args = array())
{
global $hmuser;
$hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
hook_action('ajax_add_user');
if (isset($args['id_update'])) {
$id_update = $args['id_update'];
} else {
$id_update = NULL;
}
$user_login = hm_post('user_login');
$password = hm_post('password');
$password2 = hm_post('password2');
$nicename = hm_post('nicename');
$user_email = hm_post('user_email');
$userrole = hm_post('userrole');
$user_group = hm_post('user_group', 0);
$salt = rand(100000, 999999);
$user_activation_key = '0';
if ($password != $password2) {
return json_encode(array('status' => 'error', 'mes' => _('Hai mật khẩu nhập vào không khớp')));
hm_exit();
}
$tableName = DB_PREFIX . "users";
/** check trùng user login */
if (!is_numeric($id_update)) {
$whereArray = array('user_login' => MySQL::SQLValue($user_login));
$hmdb->SelectRows($tableName, $whereArray);
if ($hmdb->HasRecords()) {
return json_encode(array('status' => 'error', 'mes' => _('Tài khoản này đã tồn tại')));
hm_exit();
}
}
$password_encode = hm_encode_str(md5($password . $salt));
/** Thêm tài khoản */
$values["user_login"] = MySQL::SQLValue($user_login);
$values["user_nicename"] = MySQL::SQLValue($nicename);
$values["user_email"] = MySQL::SQLValue($user_email);
$values["user_activation_key"] = MySQL::SQLValue($user_activation_key);
$values["user_role"] = MySQL::SQLValue($userrole);
$values["user_group"] = MySQL::SQLValue($user_group);
if (is_numeric($id_update)) {
if ($password != '') {
$values["user_pass"] = MySQL::SQLValue($password_encode);
$values["salt"] = MySQL::SQLValue($salt);
}
$whereArray = array('id' => $id_update);
$hmdb->AutoInsertUpdate($tableName, $values, $whereArray);
$insert_id = $id_update;
} else {
$values["user_pass"] = MySQL::SQLValue($password_encode);
$values["salt"] = MySQL::SQLValue($salt);
$insert_id = $hmdb->InsertRow($tableName, $values);
}
/** Lưu user field */
foreach ($_POST as $post_key => $post_val) {
if (is_numeric($insert_id)) {
if (is_array($post_val)) {
$post_val = json_encode($post_val);
}
$tableName = DB_PREFIX . 'field';
if ($post_key != 'password' and $post_key != 'password2') {
$values["name"] = MySQL::SQLValue($post_key);
$values["val"] = MySQL::SQLValue($post_val);
$values["object_id"] = MySQL::SQLValue($insert_id, MySQL::SQLVALUE_NUMBER);
$values["object_type"] = MySQL::SQLValue('user');
if (is_numeric($id_update)) {
$whereArray = array('object_id' => MySQL::SQLValue($id_update, MySQL::SQLVALUE_NUMBER), 'object_type' => MySQL::SQLValue('user'), 'name' => MySQL::SQLValue($post_key));
$hmdb->AutoInsertUpdate($tableName, $values, $whereArray);
} else {
$hmdb->InsertRow($tableName, $values);
}
}
unset($values);
}
}
if (is_numeric($id_update)) {
return json_encode(array('status' => 'updated', 'mes' => _('Đã sửa thông tin tài khoản : ' . $user_login)));
} else {
return json_encode(array('status' => 'success', 'mes' => _('Đã thêm tài khoản : ' . $user_login)));
}
}
示例10: insertCategoryLang
/**
* Metodo utilizzato per valorizzare le etichette delle categorie in base alle lingue dell'ecommerce e i tracciati passati da ERP
*
* @param type $arrCat Array contenente i dati della categoria ricevuti dal tracciato ERP
* @param type $id_category Id della categoria inserita in Prestashop
* @param type $lang Array delle lingue ricevuto dal tracciato ERP (Se empty vengono utilizzati i valori del tracciato di default)
*/
function insertCategoryLang($arrCat, $id_category, $lang)
{
foreach ($this->ecommerce_lang_by_erp as $erp_lang => $ps_id_lang) {
$values = NULL;
$values['id_category'] = MySQL::SQLValue($id_category);
$values['id_shop'] = MySQL::SQLValue(1);
$values['id_lang'] = MySQL::SQLValue($ps_id_lang);
if (!empty($lang[$erp_lang])) {
$values['name'] = MySQL::SQLValue(str_replace("’", "'", $lang[$erp_lang]));
} else {
// recupero il valore di default della lingua che deve essere usato
if (!empty($lang[$this->ecommerce_lang_by_erp[$this->default_language_ecommerce]])) {
$values['name'] = MySQL::SQLValue(str_replace("’", "'", $lang[$this->ecommerce_lang_by_erp[$this->default_language_ecommerce]]));
} else {
if (isset($arrCat[2]) and !empty($arrCat[2])) {
$values['name'] = MySQL::SQLValue(html_entity_decode(str_replace("’", "'", str_replace("à", "à", str_replace(" ", " ", str_replace("Ã", "à", htmlentities(str_replace("à", "à", $arrCat[2]))))))));
} else {
$values['name'] = MySQL::SQLValue("-Categoria Senza Nome-");
}
}
}
if (isset($arrCat[12]) and !empty($arrCat[12])) {
$values['description'] = MySQL::SQLValue(mb_convert_encoding($arrCat[12], "HTML-ENTITIES", "UTF-8"));
} else {
if (isset($arrCat[2]) and !empty($arrCat[2])) {
$values['description'] = MySQL::SQLValue($arrCat[2]);
} else {
$values['description'] = MySQL::SQLValue("-Categoria Senza Descrizione-");
}
}
$values['link_rewrite'] = MySQL::SQLValue($this->slugify($arrCat[2]));
$values['meta_title'] = MySQL::SQLValue(html_entity_decode(str_replace(" ", " ", str_replace("Ã", "à", htmlentities($arrCat[2])))));
$values['meta_keywords'] = MySQL::SQLValue(" ");
$values['meta_description'] = MySQL::SQLValue(" ");
$db = new MySQL();
$db->InsertRow("ps_category_lang", $values);
}
}
示例11:
// This checks for errors and if there is one, terminates the script
// while showing the last MySQL error.
// $db->Kill() is the same as die($db->Error()) or exit($db->Error());
if ($db->Error()) {
$db->Kill();
}
// You could also throw an exception on errors using:
// $db->ThrowExceptions = true;
// =========================================================================
// Example to insert a new row into a table and display it
// =========================================================================
// $arrayVariable["column name"] = formatted SQL value
$values["Color"] = MySQL::SQLValue("Violet");
$values["Age"] = MySQL::SQLValue(777, MySQL::SQLVALUE_NUMBER);
// Execute the insert
$result = $db->InsertRow("Test", $values);
// If we have an error
if (!$result) {
// Show the error and kill the script
$db->Kill();
} else {
// No error, show the new record's ID
echo "The new record's ID is: " . $db->GetLastInsertID() . "\n<br />\n";
// Show the record using the values array to generate the WHERE clause
// We will use the SelectRows() method to query the database
$db->SelectRows("Test", $values);
// Show the results in an HTML table
echo $db->GetHTML();
}
// =========================================================================
// Example to delete a row (or rows) in a table matching a filter
示例12: die
//prodcode
//descr
//model
//category
//url
//price
//trade
//stocklevel
//updated
//onorder
//webready
//supplier
//brand
$sql = "SELECT * from import_hkstock";
$gethk = $db->QueryArray($sql);
$new_id = $db->InsertRow("webstock", $insert);
if (!$new_id) {
//print_r ($insert);
die('Unable to write record to DB.');
}
unset($insert);
echo '</table>';
//echo('<input type="submit" name="submit" value="submit" />');
echo '</form>';
echo '<br><h4>Finished, you may close this page, </h4></body>';
// If there were no errors...
// Commit the transaction and save these records to the database
if ($db->TransactionEnd()) {
$db->Kill();
$db->Release();
print "<br><h1>Succesful database write!</h1><br>";
示例13: add_media
/** Ajax upload */
function add_media()
{
if (isset($_SERVER["CONTENT_LENGTH"])) {
if ($_SERVER["CONTENT_LENGTH"] > (int) ini_get('post_max_size') * 1024 * 1024) {
return json_encode(array('status' => 'error', 'content' => _('Dung lượng tệp tin gửi lên vượt quá giới hạn cho phép của máy chủ')));
hm_exit();
}
}
$hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
@($media_group = hm_post('media_group'));
if (!is_numeric($media_group)) {
$media_group = 0;
}
$tableName = DB_PREFIX . 'media_groups';
$whereArray = array('id' => MySQL::SQLValue($media_group));
$hmdb->SelectRows($tableName, $whereArray);
$count = $hmdb->RowCount();
if ($count != '0') {
$row = $hmdb->Row();
$folder = $row->folder;
$folder_part = get_media_group_part($media_group);
$dir = BASEPATH . HM_CONTENT_DIR . '/uploads/' . $folder_part;
if (!file_exists($dir)) {
mkdir($dir);
chmod($dir, 0777);
}
$dir_dest = BASEPATH . HM_CONTENT_DIR . '/uploads/' . $folder_part;
} else {
$folder = "/";
$media_group = 0;
$dir_dest = BASEPATH . HM_CONTENT_DIR . '/uploads';
}
$dir_pics = $dir_dest;
$files = array();
foreach ($_FILES['file'] as $k => $l) {
foreach ($l as $i => $v) {
if (!array_key_exists($i, $files)) {
$files[$i] = array();
}
$files[$i][$k] = $v;
}
}
$status = 'success';
foreach ($files as $file) {
$handle = new Upload($file, LANG);
if ($handle->uploaded) {
$handle->Process($dir_dest);
if ($handle->processed) {
/** tạo .htaccess */
$fp = fopen($dir_dest . '/.htaccess', 'w');
$content_htaccess = 'RemoveHandler .php .phtml .php3' . "\n" . 'RemoveType .php .phtml .php3';
fwrite($fp, $content_htaccess);
fclose($fp);
/** upload thành công, lưu database thông số file */
$file_is_image = 'false';
$file_info = array();
$file_info['file_src_name'] = $handle->file_src_name;
$file_info['file_src_name_body'] = $handle->file_src_name_body;
$file_info['file_src_name_ext'] = $handle->file_src_name_ext;
$file_info['file_src_mime'] = $handle->file_src_mime;
$file_info['file_src_size'] = $handle->file_src_size;
$file_info['file_dst_name'] = $handle->file_dst_name;
$file_info['file_dst_name_body'] = $handle->file_dst_name_body;
$file_info['file_dst_name_ext'] = $handle->file_dst_name_ext;
$file_info['file_is_image'] = $handle->file_is_image;
$file_name = $file_info['file_src_name'];
if ($file_info['file_is_image'] == TRUE) {
$file_is_image = 'true';
$file_info['image_src_x'] = $handle->image_src_x;
$file_info['image_src_y'] = $handle->image_src_y;
$file_info['image_src_bits'] = $handle->image_src_bits;
$file_info['image_src_pixels'] = $handle->image_src_pixels;
$file_info['image_src_type'] = $handle->image_src_type;
$file_info['image_dst_x'] = $handle->image_dst_x;
$file_info['image_dst_y'] = $handle->image_dst_y;
$file_info['image_dst_type'] = $handle->image_dst_type;
$handle->image_resize = true;
$handle->image_ratio_crop = true;
$handle->image_y = 512;
$handle->image_x = 512;
$handle->Process($dir_dest);
$file_info['thumbnail'] = $handle->file_dst_name;
}
$file_info = json_encode($file_info);
$tableName = DB_PREFIX . 'media';
$values["media_group_id"] = MySQL::SQLValue($media_group, MySQL::SQLVALUE_NUMBER);
$values["file_info"] = MySQL::SQLValue($file_info);
$values["file_name"] = MySQL::SQLValue($file_name);
$values["file_folder"] = MySQL::SQLValue($folder);
$values["file_is_image"] = MySQL::SQLValue($file_is_image);
$insert_id = $hmdb->InsertRow($tableName, $values);
unset($values);
$status = 'success';
$content[] = $insert_id;
} else {
$status = 'error';
$content[] = $file_name . ' : ' . $handle->error;
}
} else {
//.........这里部分代码省略.........
示例14: insertOrderDocumentsPdf
function insertOrderDocumentsPdf()
{
/* Init directories e files */
if (!is_dir(FOLDER_PDF)) {
mkdir(FOLDER_PDF, 0777);
}
if (!is_dir(FOLDER_TMP_PDF)) {
//$this -> fileLog("#15. Creazione directory temporanea per i PDF: " . $this -> folderTmpPdf);
mkdir(FOLDER_TMP_PDF, 0777);
}
$files = glob(FOLDER_TMP_PDF . "*");
// get all file names
foreach ($files as $file) {
if (is_file($file)) {
unlink($file);
}
}
$zip = new \ZipArchive();
$res = $zip->open(FOLDER_IMPORT_ROOT . "oi_b2b_allegati.zip");
if ($res === TRUE) {
$zip->extractTo(FOLDER_TMP_PDF);
$zip->close();
} else {
}
/* Fine Init directories e files */
$filesPdf = glob(FOLDER_TMP_PDF . "*");
$db = new MySQL();
// get all file names
foreach ($filesPdf as $filePdf) {
$fullPath = $filePdf;
$basename = basename($filePdf);
$filename = $basename;
$extension = "";
$document_id = -1;
$document_file_name = "";
if (strpos($basename, '.') !== false) {
$indexPoint = strrpos($basename, ".");
$filename = substr($basename, 0, strlen($basename) - (strlen($basename) - $indexPoint));
if ($indexPoint + 1 < strlen($basename)) {
$extension = substr($basename, $indexPoint + 1);
}
}
if (strtolower($extension) == "pdf" && strpos($filename, '_') !== false) {
$indexUnderscore = strpos($filename, "_");
$document_id_string = substr($filename, 0, strlen($filename) - (strlen($filename) - $indexUnderscore));
$document_file_name = "order" . $document_id_string . "t" . time();
if ($indexUnderscore + 1 < strlen($filename)) {
$document_file_name = substr($filename, $indexUnderscore + 1);
}
$document_id = intval($document_id_string);
}
if ($document_id > 0) {
$basenameDestination = $document_id . "_" . $document_file_name . ".pdf";
$fullPathDestination = FOLDER_PDF . $basenameDestination;
$fullPathSource = $fullPath;
copy($fullPathSource, $fullPathDestination);
$orderDocumentPdf['id_doc'] = MySQL::SQLValue($document_id);
$orderDocumentPdf['filename'] = MySQL::SQLValue($basenameDestination);
$orderDocumentPdf['uri'] = MySQL::SQLValue("/img/p/pdf/" . $basenameDestination);
$db->InsertRow("vs_orderdocuments_attachments", $orderDocumentPdf);
}
}
}
示例15: insertRelatedProduct
function insertRelatedProduct($data)
{
/*
Idassociazione int si Codice univoco dell'associazione
Cdprodotto char(50) no Codice del prodotto
Cdaccessorio char(50) no Codice del prodotto da associare al primo
Dsaccessorio char(1000) no Descrizione breve del prodotto associato
flagAccessorio bool Manca: se � = 1 e' un prodotto accessorio, altrimenti prod correlato.
*/
/* DEVO CONTROLLARE CHE IL RECORD NON SIA APPARTENENTE ALAL GESTIONE DELLe TAGLIE */
# faccio lo split in base al delimitatore per la gestione delle taglie
$array_combination = explode(DELIMITATORE_TAGLIE, $data[1]);
if (count($array_combination) > 1) {
$data[1] = $array_combination[0];
}
$array_combination2 = explode(DELIMITATORE_TAGLIE, $data[2]);
if (count($array_combination2) > 1) {
$data[2] = $array_combination2[0];
}
/* Parte prodotti accessori */
$prod1 = $this->getIdProductFromCode($data[1]);
$prod2 = $this->getIdProductFromCode($data[2]);
$db = new MySQL();
//FIXME:
if (isset($data[4]) and !empty($data[4]) and $data[4] != 1) {
// e' un prodotto sostitutivo
$crossProduct['id_product_1'] = MySQL::SQLValue($prod1);
$crossProduct['id_product_2'] = MySQL::SQLValue($prod2);
$crossProduct['description'] = MySQL::SQLValue($data[3]);
$db->InsertRow("ps_visioncrossselling", $crossProduct);
} else {
// e' un prodotto accessorio
$accessoryProduct['id_product_1'] = MySQL::SQLValue($prod1);
$accessoryProduct['id_product_2'] = MySQL::SQLValue($prod2);
$db->InsertRow("ps_accessory", $accessoryProduct);
}
}