Skip to main content

Posts

Showing posts from September, 2016

Upload files and folders on GitHUB [tutorial]

Upload files and folders on GitHUB To upload your project or files and folder on github with files and folder on linux system you have to follow these simple steps. Open Console by Ctrl+Alt+T First make the repository (Name=RepositoryName) from your profile page-> repository tab and click on New button  on github. Open the terminal and make the new directory (mkdir NewDirectory) or create manually a new folder or directory. Copy your ProjectFolder to this NewDirectory. Change the present work directory to NewDirectory.              cd NewDirectory Run the following command one by one       git init       git add ProjectFolderName       git commit -m "first commit"       git remote add origin https://github.com/YourGithubUsername/RepositoryName.git       git push -u origin master If console window show error something like this  ! [rejected]        master -> master (fetch first) error: failed to push some refs to 'https://github.c

Upload Large CSV into mysql in a minute PHP Script

How to upload large CSV file in Mysql Database within a minute [ PHP SCRIPT ] IF you have large csv file and you want to upload in Mysql then mysql will take too much time to import that csv data . so here is the script that will  take less a minute and all csv data will uploaded in mysql. This Script contains a html form you have to fill information of your database and also insert file name in "Name of the file" column and also notice that your file and this script must be exist in same folder. SO here is the PHP script to upload large CSV file in mysql within a minute. <?php if(isset($_POST['username'])&&isset($_POST['mysql'])&&isset($_POST['db'])&&isset($_POST['username'])) { $sqlname=$_POST['mysql']; $username=$_POST['username']; $table=$_POST['table']; if(isset($_POST['password'])) { $password=$_POST['password']; } else { $password= ''; } $db=$_POST[&

Simply Create Excel Spreadsheets in PHP without using any library

Simply Create Excel Spreadsheets in PHP In PHP , create excel Spreadsheets of database data we only need to set headers. header("Content-Type: application/vnd.ms-excel"); and header("Content-disposition: attachment; filename=city.xls"); The First header we need to set content type ms-excel . The Second header will make file downloadable. when we run this file into browser then browser will ask to download xls file. Example 1 echo 'Name' . "\t" . 'Address' . "\t" . 'Contact' . "\n"; echo 'Coderain' . "\t" . 'Internet' . "\t" . '111111111' . "\n"; Explaination Example 1 will add Name , Address , Contact column into excel as a header of excel file. then you can add data after this. \t = \t is used for end current tab or column and go to the next tab or column. \n = \n is used for go to next Row or Line. Here is the complete example of create excel file of

Show popup at once Bootstrap Jquery

 Show popup at once Bootstrap Jquery  Sometimes we want to show login signup or welcome popup at once to per user . we can show popup at once to user by using jQuery .  We can show popup at once with jquery using two methods  1. localStorage- localStorage is relatively new concept that stores data with no expiration date on client side.  2. Cookies - Cookies also stores data on client side but the main difference between localStorage and Cookies is that Cookies can manipulated from the server side.  For our example we are using Bootstrap Modal Popup .to use Bootstrap Modal Popup you should call bootstrap js and css class. <!-- BootStrap Modal Popup --> <button type="button" id="btntpr" class="btn btn-info  btn-lg" data-toggle="modal" data-target="#signupnow">Open Modal</button> <!-- Modal --> <div id="signupnow" class="modal fade" role="dialog">   <div class=

Select query in cakephp 3.x

Select query with multiple where conditions in cakephp 3.x First include these classes into your controller to use objects of these classes use Cake\ORM\Query; use Cake\ORM\Table; use App\Model\Entity\Role; use Cake\ORM\TableRegistry; Simple Select query in cakephp 3.x  $tableRegObj = TableRegistry::get('OurTableName');  //database Table name = our_table_name  $getAllResults = $tableRegObj->find('all');  $getAllResults will return results object . if you want to count records then you can use count function of this  example =>  echo $getAllResults->count();  If you want fetch data as an array then you can use toArray();  example =>  $getAllResults = $tableRegObj->find('all')->toArray();  If you want to fetch only first row of result data then you can use first()  example=>  $getFirstRow = $getAllResults->first();  2.Fetch Data with conditions       In cakephp 3.x you can use multiple conditions with fetch