Posts

Showing posts from October, 2016

PHP add or subtract days,months,years,time from date("...")

Adding Days [code]$currdate = date(“Y-m-d”); $add_day = strtotime(‘+<strong>N</strong> day’, strtotime($currdate )); $add_day = date(‘Y-m-d’, $add_day); [/code] or simply use [code] $add_day = date("Y-m-d", strtotime("+N day", strtotime(date("Y-m-d") ))); [/code] it will result $add_day by adding N days to current date Adding Months [code] $currdate = date(“Y-m-d”); $add_month = strtotime(‘+<strong>N</strong> month’, strtotime($currdate )); $add_month = date(‘Y-m-d’, $add_month); [/code] it will result $add_day by adding N months to current date Adding Years [code] $currdate = date(“Y-m-d”); $add_year = strtotime(‘+<strong>N</strong> year’, strtotime($currdate )); $add_year = date(‘Y-m-d’, $add_year); [/code] it will result $add_day by adding N years to current date for subtracting just add - N month or - N year or - N day instead of using plus(+ N day) Note :here N is any integer Number like 0,1,2,3,4,.....

Text box that allows only numbers using JQuery

below code will allows text box to enter numerics only To use this you need use numaric as class element as shown below   $(".numeric").keydown(function(event) { // Allow only backspace and delete if ( event.keyCode == 46 || event.keyCode == 8 ) { // let it happen, don't do anything } else { // Ensure that it is a number and stop the keypress if (event.keyCode 57 ) { event.preventDefault(); } } });

Google Maps in Leaflet Map

Streets googleStreets = L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',{ maxZoom: 20, subdomains:['mt0','mt1','mt2','mt3'] }); Hybrid: googleHybrid = L.tileLayer('http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}',{ maxZoom: 20, subdomains:['mt0','mt1','mt2','mt3'] }); Satellite: googleSat = L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{ maxZoom: 20, subdomains:['mt0','mt1','mt2','mt3'] }); Terrain googleTerrain = L.tileLayer('http://{s}.google.com/vt/lyrs=p&x={x}&y={y}&z={z}',{ maxZoom: 20, subdomains:['mt0','mt1','mt2','mt3'] }); Note the difference in the "lyrs" parameter in the URL: Hybrid: s,h; Satellite: s; Streets: m; Terrain: p;

How to "Import SQL file to MySQL"

[youtube https://www.youtube.com/watch?v=T3A-wfqtjZA] first, create the database then select that database (use database_name) then, use the following command source sql_file_path(C://file.sql) then click enter Thatsall

PHP input text reading without getting error

You can use any of the following processes if ( isset ( $_POST [ 'submit ' ])) { ... } <input type="text" name=" search_id " id= " search_id "> <input type = "submit" name = "submit" value = "Submit" /> $search_id = isset($_POST['search_id'])?$_POST['search_id']:0; another way is $search_id="0"; if(isset($_POST['sea'])){ $search_id=$_POST['search_id']; if($search_id==""){ $search_id="0"; } }