View php mysql speed insert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$userData = array(); | |
foreach ($userList as $user) { | |
$userData[] = '("' . $user['first_name'] . '", "' . $user['last_name'] . '")'; | |
} | |
$query = 'INSERT INTO users (first_name,last_name) VALUES' . implode(',', $userData); | |
==========>>>>>>>> | |
INSERT INTO users (first_name,last_name) VALUES("John", "Doe"),("Jane", "Doe")... | |
////////////////////////////////////////////////// |
View php file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!is_dir('uploads/')) { | |
mkdir('./uploads/', 0777, TRUE); | |
} | |
$fopen = fopen('./uploads/' . $date_time . '-' . $date . '.json', "w+"); | |
$fwrite = fwrite($fopen, $_REQUEST['jsonString']); |
View php get ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUserIpAddr() { | |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //if from shared | |
return $_SERVER['HTTP_CLIENT_IP']; | |
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //if from a proxy | |
return $_SERVER['HTTP_X_FORWARDED_FOR']; | |
} else { | |
return $_SERVER['REMOTE_ADDR']; | |
} | |
} |
View validate insert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function placeStockProduct($dataArray) { | |
print_r($dataArray); | |
$count = $dataArray['count2']; | |
$sql = "INSERT INTO `outlet_stock_check` (`outlet_name`, `outlet_id`, `product_name`, `product_id`, `qty`) VALUES "; | |
$do = FALSE; | |
for ($index = 0; $index < $count; $index++) { | |
if (isset($dataArray['product_name_' . $index]) && !empty($dataArray['product_qty_' . $index])) { | |
$sql.="('', '', '" . $dataArray['product_name_' . $index] . "', ''," . $dataArray['product_qty_' . $index] . ")"; | |
if (!$do) { | |
$do = TRUE; |
View mysql date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date_format(now(), '%Y-%m-01') AND LAST_DAY(curdate()) | |
SELECT | |
DATE_SUB(DATE_FORMAT(NOW(),'%Y-%m-%d'),INTERVAL 1 DAY) AS GetLastDay, | |
DATE_FORMAT(NOW(),'%Y-%m-%d') AS GetTodaysDate, | |
DATE_ADD(DATE_FORMAT(NOW(),'%Y-%m-%d'),INTERVAL 7 DAY) AS Add7DaysFromTodaysDate, | |
DATE_SUB(DATE_FORMAT(NOW(),'%Y-%m-%d'),INTERVAL 7 DAY) AS Substract7DaysFromTodaysDate, | |
DATE_ADD(DATE_FORMAT(NOW(),'%Y-%m-%d'),INTERVAL 1 MONTH) AS Add1MonthFromTodaysDate, |
View mysql tip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cast(field as decimal(14, 2)) as formatted |
View mapsearch view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://drive.google.com/file/d/0B-zS4yAhFGgEYTZzeVJlTkVmUlk/edit?usp=sharing | |
<?php | |
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ |
View js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$('#from_date_txt').datepicker({ | |
changeMonth: true, | |
changeYear: true, | |
showButtonPanel: true, | |
dateFormat: 'MM yy', | |
maxDate: 0, | |
onClose: function(dateText, inst) { | |
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val(); | |
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val(); |
View gist:9038832
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var product_Name_id = $j('#product_Name_1 option:selected').attr("id"); | |
var product_Name = $j('#product_Name_1 option:selected').text(); |
View check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('input:checkbox').prop('checked', false); | |
$("input[name=type]:checked").val() |
OlderNewer