Posts

Why my bootstrap css is not working on mobiles?

Bootstrap css is not working on mobiles when all is fine in your  Bootstrap  html code. and when you open your site on mobile then it shows as  it shows onn your pc. and you still you are frustrate that why  Bootstrap css  is not working. so please check your meta tag did you add this code in of head tag of html <meta name="viewport" content="width=device-width, initial-scale=1.0" />  most of the people when create Bootstrap css the forgot to add this on head tag in html thats why this css not working on mobiles browser so add this code in head tag of html code  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

How to compare two dates via javascript?

How to compare two dates via java-script or how to check two dates that which one is greater and smaller? here is a code where you can check that which date is greater then other or same as vice verse. Simply copy and paste below code in your html file and run the file and change variable according to your need. Note: date format can be in two format one  2012-12-26 00:00:00  or 2012/12/26 00:00:00 Date compare <script> var s_date1 = "2012-12-26 00:00:00"; var en_date1 = "2012-12-26 00:00:00"; var s_date1_new=s_date1.replace(/-/g,"/"); // this line is for if date format is in hyphen like  2013-12-12 00:00:00 var en_date1_new=en_date1.replace(/-/g,"/"); // this line is for if date format is in hyphen like  2013-12-12 00:00:00 var date_ini = new Date(s_date1_new).getTime(); var date_end = new Date(en_date1_new).getTime(); if(isNaN(date_ini)) { alert("Start date format is wrong!"); return false; } if(isNaN(

How to upload a file in php with php validation of extension?

Simply copy and paste this code on your page And your input file name will be uploadedfile Like <input type="file" name="uploadedfile" /> and on submit of this page you will add this code $youruniqueid could be anything like userid or projected on the basis of this it will create folder for image upload $projId=$youruniqueid;    if(!empty($_FILES['uploadedfile']['name'])){     $imgExtension = array("jpg","jpe","jpeg","gif","png","GIF","JPG","JPEG","txt","pdf","PDF","docx","xlsx","pptx","pptm","doc","dot","xls","ppt");         $image_name = pathinfo($_FILES['uploadedfile']['name']);     $extension = strtolower($image_name['extension']);         if(in_array($extension,$imgExtension)){             $file_name = $_FILES['uplo

How to make a download link for download file in php

How to make a download link for download file in php or create a download link for download file in php? so here is the code and add base url according to your need   Create a php file download.php and paste this code in you php file $name = $_REQUEST['name']; // The file path where the file exists $filepath = 'http://www.site.com/files/'.$name; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); //setting content type of page header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($filepath )); header("Content-Description: File Transfer"); //Read File it will start downloading @readfile($filepath); Now add this link in your file on your anchor tag like <a href=" http://www.site.com/download.php?name=file.png " >download link</a>

How to get date from a timestamp in mysql?

Image
How to get date from a timestamp in mysql? simple you can use FROM_UNIXTIME function and pass the parameter. my table name is  messages like this: SELECT FROM_UNIXTIME(`created`,'%Y-%m-%d') as date FROM `messages`

How to create thumb image of uploaded image in php?

Simply copy and paste this code in your page and call generate_thumbimage_thumbnail() somthing like that $path  = 'uploadediamgepath/myimage.png'; $save_path2  = 'project_image_thumb/thumb__myimage.png'; $iscopied2 = copy($path , $save_path2); if($iscopied2){ generate_image_thumbnail($path, $save_path2); } function generate_thumbimage_thumbnail($source_image_path, $thumbnail_image_path) { define('THUMBNAIL_IMAGE_MAX_WIDTH', 130); define('THUMBNAIL_IMAGE_MAX_HEIGHT', 130); list($source_image_width, $source_image_height, $source_image_type) = getimagesize($source_image_path); switch ($source_image_type) { case IMAGETYPE_GIF: $source_gd_image = imagecreatefromgif($source_image_path); break; case IMAGETYPE_JPEG: $source_gd_image = imagecreatefromjpeg($source_image_path); break; case IMAGETYPE_PNG: $source_gd_image = imagecreatefrompng($source_image_path); break; } if ($source_gd_imag

How to get second last array in php?

lets take an example like this is your array Array ( [0] => 14802 Stony Plain Rd NW [1] => Edmonton [2] => AB T5N 3S5 ) and you want to get second last array " Edmonton" then simple use this array like this end ( $array ); $z = prev ( $array ); this is effective and you can get second last array. :)