当前位置: 首页>>代码示例>>PHP>>正文


PHP insertRecord函数代码示例

本文整理汇总了PHP中insertRecord函数的典型用法代码示例。如果您正苦于以下问题:PHP insertRecord函数的具体用法?PHP insertRecord怎么用?PHP insertRecord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了insertRecord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insertGameData

function insertGameData()
{
    $sql = "INSERT INTO `ca_letterTime`(`letter`, `duration`) VALUES (:letter,:time)";
    $namedParameters = array();
    $namedParameters[':letter'] = $_GET['letter'];
    $namedParameters[':time'] = $_GET['time'];
    insertRecord($sql, $namedParameters);
}
开发者ID:rciampa,项目名称:CST336,代码行数:8,代码来源:database.php

示例2: readFromFile

function readFromFile($conn, $fname, $dryrun)
{
    //This is my function to read from the csv file.
    if ($dryrun) {
        fwrite(STDOUT, "\n[DRYRUN: Reading from file (\"" . $fname . "\")]");
    } else {
        fwrite(STDOUT, "\n[Reading from file (\"" . $fname . "\") and Inserting into DB]");
    }
    $file = fopen($fname, "r");
    //Open the file.
    $firstLine = true;
    //We don't need the first line (it's the headers).
    while (!feof($file)) {
        //While we are not at the end of the file...
        if ($firstLine) {
            $firstLine = false;
            fgetcsv($file);
            //Read in the first line and don't do anything with it.
        } else {
            $person = fgetcsv($file);
            //Read in all details.
            $name = cleanString($person[0]);
            //Clean the string.
            $surname = cleanString($person[1]);
            //Clean the string.
            $email = trim(strtolower($person[2]));
            //trim trims whitespace, strtolower puts the string to lowercase.
            $emailFlag = filter_var($email, FILTER_VALIDATE_EMAIL);
            //Use php's function for checking valid emails.
            if ($emailFlag) {
                //If it's a valid email...
                if (!$dryrun) {
                    //If we are not on a dry run, we have access to the DB.
                    insertRecord($conn, $name, $surname, $email);
                    //Call function to insert.
                } else {
                    fwrite(STDOUT, "\nPerson: " . $name . " " . $surname . " (" . $email . ")");
                }
            } else {
                //If email isn't valid, tell the user.
                fwrite(STDOUT, "\n[ERROR]: The supplied email address, \"" . $email . "\", is invalid");
            }
        }
    }
    fclose($file);
    //Close the file after we are done.
}
开发者ID:Rickerss,项目名称:Catalyst-FebTest,代码行数:47,代码来源:user_upload.php

示例3: elementoEquipaInsert

function elementoEquipaInsert($fields)
{
    unset($fields['id_elemento_equipa']);
    $fields['id_elemento_equipa'] = insertRecord('elementos_equipas', $fields, true);
}
开发者ID:ricain59,项目名称:fortaff,代码行数:5,代码来源:elementosequipas.php

示例4: modifrepInsert

function modifrepInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("modifrep", $fields, true);
}
开发者ID:ricain59,项目名称:fortaff,代码行数:5,代码来源:dbmodifreparador.php

示例5: add_link

function add_link($in)
{
    // establish whether the required variables are all present
    $precondition = array("url", "cap", "cat");
    $required_vars_are_present = checkVarsPresent($in, $precondition);
    if ($required_vars_are_present) {
        $results = insertRecord($in);
    } else {
        $results = [];
        $results["meta"]["ok"] = false;
        $results["meta"]["status"] = 400;
        $results["meta"]["msg"] = "Bad Request";
        $results["meta"]["feedback"] = "That request doesn't appear to have all the necessary fields for it to work.";
        $results["meta"]["developer"] = "See the required and received fields in json metadata to evaluate what was omitted.";
        $results["meta"]["received"] = $in;
        $results["meta"]["required"] = $precondition;
    }
    return $results;
}
开发者ID:Ollie1700,项目名称:linbeta,代码行数:19,代码来源:io.php

示例6: trim

// load vars
$item_id = trim($_POST["item_id"]);
$coord_x1 = trim($_POST["coord_x1"]);
$coord_y1 = trim($_POST["coord_y1"]);
$coord_x2 = trim($_POST["coord_x2"]);
$coord_y2 = trim($_POST["coord_y2"]);
$width = trim($_POST["width"]);
$height = trim($_POST["height"]);
// verify if a row is already there in type_map for given item_id
$map_result = fetchSimpleTotal("sale_maps", "sales_id = " . $item_id);
// if not there yet, add it, else update
if ($map_result == 0) {
    // insert the item into [sale_maps]
    $sql_fields = "sales_id, coord_x1, coord_y1, coord_x2, coord_y2, width, height, date_modified";
    $sql_values = "'" . $item_id . "', '" . $coord_x1 . "', '" . $coord_y1 . "', '" . $coord_x2 . "', '" . $coord_y2 . "', '" . $width . "', '" . $height . "', NOW()";
    $image_id = insertRecord("sale_maps", $sql_fields, $sql_values, TRUE);
} else {
    // update item in [sale_maps]
    $sql = "UPDATE sale_maps SET ";
    $sql .= "coord_x1 = " . $coord_x1 . ", ";
    $sql .= "coord_y1 = " . $coord_y1 . ", ";
    $sql .= "coord_x2 = " . $coord_x2 . ", ";
    $sql .= "coord_y2 = " . $coord_y2 . ", ";
    $sql .= "width = " . $width . ", ";
    $sql .= "height = " . $height . ", ";
    $sql .= "date_modified = NOW() ";
    $sql .= "WHERE sales_id = '" . $item_id . "' ";
    $sqlConn->Execute($sql);
}
// Send back to edit page on #map anchor
header("Location: sales_edit.php?action=edit&result=update&item_id=" . $item_id . "#map");
开发者ID:alejandrozepeda,项目名称:gvm,代码行数:31,代码来源:sales_map_crop.php

示例7: recheioInsert

function recheioInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("pp_recheio", $fields, true);
}
开发者ID:ricain59,项目名称:fortaff,代码行数:5,代码来源:pp_recheio.php

示例8: array

    }
    if ($mb_forbid_pattern != "") {
        if (preg_match($mb_forbid_pattern, $body)) {
            if (!preg_match($mb_forbid_except_pattern, $body)) {
                $body = "";
            }
        }
    }
    if ($body != "") {
        $fields = array("board", "created", "author", "body");
        $values = array("\"{$mb_board}\"", "now()", "\"{$author}\"", "\"{$body}\"");
        if ($mb_fld_subject != "") {
            $fields[] = $mb_fld_subject;
            $values[] = "\"{$subject}\"";
        }
        if (insertRecord($mb_table, $fields, $values)) {
            ?>
					<div style="<?php 
            echo $style1;
            ?>
">
					<div style="<?php 
            echo $style2;
            ?>
"><b>Info</b></div>
					<?php 
            echo $mb_posted_msg;
            ?>
					</div>
					<br>
				<?php 
开发者ID:piter65,项目名称:spilldec,代码行数:31,代码来源:msgbrd.php

示例9: trim

// load vars
$item_id = trim($_POST["item_id"]);
$coord_x1 = trim($_POST["coord_x1"]);
$coord_y1 = trim($_POST["coord_y1"]);
$coord_x2 = trim($_POST["coord_x2"]);
$coord_y2 = trim($_POST["coord_y2"]);
$width = trim($_POST["width"]);
$height = trim($_POST["height"]);
// verify if a row is already there in type_map for given item_id
$map_result = fetchSimpleTotal("activity_maps", "activities_id = " . $item_id);
// if not there yet, add it, else update
if ($map_result == 0) {
    // insert the item into [activity_maps]
    $sql_fields = "activities_id, coord_x1, coord_y1, coord_x2, coord_y2, width, height, date_modified";
    $sql_values = "'" . $item_id . "', '" . $coord_x1 . "', '" . $coord_y1 . "', '" . $coord_x2 . "', '" . $coord_y2 . "', '" . $width . "', '" . $height . "', NOW()";
    $image_id = insertRecord("activity_maps", $sql_fields, $sql_values, TRUE);
} else {
    // update item in [activity_maps]
    $sql = "UPDATE activity_maps SET ";
    $sql .= "coord_x1 = " . $coord_x1 . ", ";
    $sql .= "coord_y1 = " . $coord_y1 . ", ";
    $sql .= "coord_x2 = " . $coord_x2 . ", ";
    $sql .= "coord_y2 = " . $coord_y2 . ", ";
    $sql .= "width = " . $width . ", ";
    $sql .= "height = " . $height . ", ";
    $sql .= "date_modified = NOW() ";
    $sql .= "WHERE activities_id = '" . $item_id . "' ";
    $sqlConn->Execute($sql);
}
// Send back to edit page on #map anchor
header("Location: activities_edit.php?action=edit&result=update&item_id=" . $item_id . "#map");
开发者ID:alejandrozepeda,项目名称:gvm,代码行数:31,代码来源:activities_map_crop.php

示例10: magicAddSlashes

 }
 // insert the item into [rentals], and return item_id
 $sql_fields = "locations_id, name, code, type, is_featured, highlights_en, highlights_fr, highlights_es, address, \r\n\t\t               rooms, sleeps, has_internet, has_longstay, has_safe, size_m2, \r\n\t\t\t       size_f2, has_pool, pool_type, has_smoking, has_animals, distance_beach, beds, beds_details_en, beds_details_fr, \r\n\t\t\t       beds_details_es, bathrooms, bathrooms_details, has_bbq, has_lastminute, price_low, price_medium, price_high, price_vacation, \r\n\t\t\t       price_long_stay, has_promotion, price_promotion, deadline_promotion, google_map, online, rank, date_created, date_modified, project_id";
 $sql_values = "'" . magicAddSlashes($locations_id) . "',\r\n\t\t\t       '" . magicAddSlashes($name) . "', \r\n\t\t\t       '" . magicAddSlashes($code) . "', \r\n\t\t\t       '" . magicAddSlashes($type) . "', \r\n\t\t\t       '" . magicAddSlashes($is_featured) . "',  \r\n\t\t\t       '" . magicAddSlashes($highlights_en) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_fr) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_es) . "', \r\n\t\t\t       '" . magicAddSlashes($address) . "', \r\n\t\t\t       '" . magicAddSlashes($rooms) . "', \r\n\t\t\t       '" . magicAddSlashes($sleeps) . "', \r\n\t\t\t       '" . magicAddSlashes($has_internet) . "', \r\n\t\t\t       '" . magicAddSlashes($has_longstay) . "', \r\n\t\t\t       '" . magicAddSlashes($has_safe) . "', \r\n\t\t\t       '" . magicAddSlashes($size_m2) . "', \r\n\t\t\t       '" . magicAddSlashes($size_f2) . "', \r\n\t\t\t       '" . magicAddSlashes($has_pool) . "', \r\n\t\t\t       '" . magicAddSlashes($pool_type) . "', \r\n\t\t\t       '" . magicAddSlashes($has_smoking) . "', \r\n\t\t\t       '" . magicAddSlashes($has_animals) . "', \r\n\t\t\t       '" . magicAddSlashes($distance_beach) . "', \r\n\t\t\t       '" . magicAddSlashes($beds) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_en) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_fr) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_es) . "', \r\n\t\t\t       '" . magicAddSlashes($bathrooms) . "', \r\n\t\t\t       '" . magicAddSlashes($bathrooms_details) . "', \r\n\t\t\t       '" . magicAddSlashes($has_bbq) . "', \r\n\t\t\t\t   '" . magicAddSlashes($has_lastminute) . "', \r\n\t\t\t       '" . magicAddSlashes($price_low) . "', \r\n\t\t\t       '" . magicAddSlashes($price_medium) . "', \r\n\t\t\t       '" . magicAddSlashes($price_high) . "', \r\n\t\t\t       '" . magicAddSlashes($price_vacation) . "', \r\n\t\t\t       '" . magicAddSlashes($price_long_stay) . "', \r\n\t\t\t       '" . magicAddSlashes($has_promotion) . "', \r\n\t\t\t       '" . magicAddSlashes($price_promotion) . "', \r\n\t\t\t       '" . magicAddSlashes($deadline_promotion) . "', \r\n\t\t\t       '" . magicAddSlashes($google_map) . "', \r\n\t\t\t       '" . magicAddSlashes($online) . "', \r\n\t\t\t       '" . intval($db_rank) . "', \r\n\t\t\t       NOW(), \r\n\t\t\t       NOW(),\r\n\t\t\t\t   " . intval($project_id);
 $item_id = insertRecord("rentals", $sql_fields, $sql_values, TRUE);
 $estampa_large = imagecreatefrompng(FILES_PATH . 'logo_large.png');
 $estampa_medium = imagecreatefrompng(FILES_PATH . 'logo_medium.png');
 $estampa_thumbs = imagecreatefrompng(FILES_PATH . 'logo_thumbs.png');
 $rankImage = 1;
 // put file in DB, and place file in directory, if uploaded
 foreach ($file_image["name"] as $key => $name_file) {
     if ($name_file != "") {
         // insert the item into [news_images], and return photo_id
         $sql_fields = "rentals_id, image, rank, date_created, date_modified";
         $sql_values = "'" . magicAddSlashes($item_id) . "', '', '" . $rankImage . "', NOW(), NOW()";
         $photo_id = insertRecord("rental_photos", $sql_fields, $sql_values, TRUE);
         $rankImage++;
         // clean up filenames
         $filename = $name_file;
         $filename = $item_id . "_" . $photo_id . "_" . $filename;
         $filename = cleanData($filename);
         /// include auto cropper, to limit photo filesize
         include_once $path_to_dynamik . "auto_cropper.inc.php";
         // full - save the new (cropped) image to the folder
         $crop = new autoCropper(imagecreatefromjpeg($file_image["tmp_name"][$key]), FILES_PATH . FILES_RENTALS_LARGE . $filename, IMG_RENTALS_LARGE_WIDTH, IMG_RENTALS_LARGE_HEIGHT, IMG_RENTALS_LARGE_FIXED, 100, array(255, 255, 255));
         $crop->processImage();
         // chmod the file
         @chmod(FILES_PATH . FILES_RENTALS_LARGE . $filename, 0777);
         // Watermark large
         $margen_dcho = 0;
         $margen_inf = 0;
开发者ID:alejandrozepeda,项目名称:gvm,代码行数:31,代码来源:rentals_edit.php

示例11: add_email_as_record


//.........这里部分代码省略.........
        //error_log(">>>>ARRAY=".print_r($arrnew, true));
        $_POST = $arrnew;
        $statusKey = getDetailTypeLocalID(DT_BUG_REPORT_STATUS);
        /*****DEBUG****/
        //error_log("status key ".print_r($statusKey,true));
        if ($statusKey) {
            $_POST["type:" . $statusKey] = array("Received");
        }
    } else {
        if (defined('RT_NOTE')) {
            // this is from usual email - we will add email rectype
            //error_log(" in emailProccesor as Note");
            // liposuction away those unsightly double, triple and quadruple spaces
            $description = preg_replace('/ +/', ' ', $description);
            // trim() each line
            $description = preg_replace('/^[ \\t\\v\\f]+|[ \\t\\v\\f]+$/m', '', $description);
            $description = preg_replace('/^\\s+|\\s+$/s', '', $description);
            // reduce anything more than two newlines in a row
            $description = preg_replace("/\n\n\n+/s", "\n\n", $description);
            //consider this message as usual email and
            $_POST["save-mode"] = "new";
            $_POST["notes"] = "";
            $_POST["rec_url"] = "";
            /* FOR EMAIL RECORD TYPE  - BUT IAN REQUIRES POST "NOTE" RECORDTYPE
            			$_POST["type:160"] = array($email->getSubject());
            			$_POST["type:166"] = array(date('Y-m-d H:i:s')); //date sent
            			$_POST["type:521"] = array($email->getFrom()); //email owner
            			$_POST["type:650"] = array($email->getFrom()); //email sender
            			$_POST["type:651"] = array("prime.heurist@gmail.com"); //recipients
            			//$_POST["type:221"] = array(); //attachments
            			$_POST["type:560"] = array($description);
            
            			$_POST["rectype"]="183";  //EMAIL
            			*/
            if (defined('DT_NAME')) {
                $_POST["type:" . DT_NAME] = array($email->getSubject());
            }
            //title
            //$_POST["type:158"] = array("email harvesting"); //creator (recommended)
            if (defined('DT_DATE')) {
                $_POST["type:" . DT_DATE] = array(date('Y-m-d H:i:s'));
            }
            //specific date
            if (defined('DT_SHORT_SUMMARY')) {
                $_POST["type:" . DT_SHORT_SUMMARY] = array($email->getFrom() . " " . $description);
            }
            //notes
            $_POST["rectype"] = RT_NOTE;
            //NOTE
            $_POST["check-similar"] = "1";
            $arr = saveAttachments(null, $email);
            if ($arr == 0) {
                return false;
            } else {
                if (count($arr) > 0) {
                    if (defined('DT_FILE_RESOURCE')) {
                        $_POST['type:' . DT_FILE_RESOURCE] = $arr;
                    }
                    //array_push($_POST['type:221'], $arr);
                    /*****DEBUG****/
                    //error_log(">>>>>>>>>ARRAY>>".print_r($arr, true));
                }
            }
            /*****DEBUG****/
            //error_log(">>>>>>>>>HERE>>>>>>".print_r($_POST['type:221'],true));
        }
    }
    if ($email->getErrorMessage() == null) {
        $_POST["owner"] = get_user_id();
        $sss = $email->getFrom();
        if (is_array($sys_sender)) {
            foreach ($sys_sender as $sys_sender_email) {
                if ($sys_sender_email == $sss || strpos($sss, "<" + $sys_sender_email + ">") >= 0) {
                    $_POST["owner"] = $ownership;
                    break;
                }
            }
        }
        $_POST["visibility"] = 'hidden';
        /*****DEBUG****/
        //error_log(">>>>before insert POST=".print_r($_POST, true));
        $updated = insertRecord($_POST['rectype']);
        //from saveRecordDetails.php
        if ($updated) {
            $rec_id = $_REQUEST["recID"];
            $email->setRecId($rec_id);
        }
        /*****DEBUG****/
        //error_log("updated = $updated  recID = $rec_id ");
    }
    printEmail($email);
    //$rec_id=null;
    if ($rec_id) {
        //($rec_id){
        return true;
    } else {
        $emails_failed++;
        return false;
    }
}
开发者ID:beoutsports,项目名称:heurist-v3-1,代码行数:101,代码来源:emailProcessor.php

示例12: modifBolosInsert

function modifBolosInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("pp_modif_bolos", $fields, true);
}
开发者ID:ricain59,项目名称:fortaff,代码行数:5,代码来源:pp_modif_bolos.php

示例13: magicAddSlashes

// submit data if no form_error and for was submitted
if ($form_submit == "Y" && $form_error == "") {
    //all data checks out, can proceed with inserting / updating [activities]
    if ($action == "add") {
        // rank check - new item at top of list - others go down a rank
        if ($online == "Y") {
            $db_rank = 1;
            $sql = "UPDATE activities SET rank = rank + 1 WHERE online = 'Y' ";
            $sqlConn->Execute($sql);
        } else {
            $db_rank = 0;
        }
        // insert the item into [activities], and return item_id
        $sql_fields = "name_en, name_fr, name_es, description_en, description_fr, description_es, intro_en, intro_fr, intro_es, highlights_en, highlights_fr, \r\n\t\t\t       highlights_es, online, rank, date_created, date_modified";
        $sql_values = "'" . magicAddSlashes($name_en) . "',\r\n\t\t\t\t   '" . magicAddSlashes($name_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($name_es) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_en) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_es) . "', \r\n\t\t\t\t   '" . magicAddSlashes($intro_en) . "', \r\n\t\t\t\t   '" . magicAddSlashes($intro_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($intro_es) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_en) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_fr) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_es) . "', \r\n\t\t\t       '" . magicAddSlashes($online) . "', \r\n\t\t\t       '" . intval($db_rank) . "', \r\n\t\t\t       NOW(), \r\n\t\t\t       NOW()";
        $item_id = insertRecord("activities", $sql_fields, $sql_values, TRUE);
        //echo  $item_id;
        //exit();
        /* // put file in DB, and place file in directory, if uploaded
                  if ($file_image["name"] != "") {
                  // insert the item into [news_images], and return photo_id
                  $sql_fields = "activities_id, image, rank, date_created, date_modified";
                  $sql_values = "'".magicAddSlashes($item_id)."', '', '1', NOW(), NOW()";
                  $photo_id = insertRecord("activity_photos", $sql_fields, $sql_values, TRUE);
        
                  // clean up filenames
                  $filename = $file_image["name"];
                  $filename = $item_id."_".$photo_id."_".$filename;
                  $filename = cleanData($filename);
        
                  /// include auto cropper, to limit photo filesize
开发者ID:alejandrozepeda,项目名称:gvm,代码行数:31,代码来源:activities_edit.php

示例14: provaClassificacaoInsert

function provaClassificacaoInsert($fields)
{
    unset($fields['id_classificacao']);
    $fields['id_classificacao'] = insertRecord('provas_classificacoes', $fields, true);
}
开发者ID:ricain59,项目名称:fortaff,代码行数:5,代码来源:provas_classificacoes.php

示例15: reparadorInsert

function reparadorInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("reparador", $fields, true);
}
开发者ID:ricain59,项目名称:fortaff,代码行数:5,代码来源:dbreparador.php


注:本文中的insertRecord函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。