Posts

How to remove a field from a collection in mongoDB?

How to remove a field from a collection in mongoDB? By this query you can remove a field from whole collection in mongoDB db.colleciton.update(     //  where query like: where active="yes"     {         "active" : "yes"     },         // will remove Name field from current collection     {         $unset: {"Name":""}     },         // options     {         "multi" : true  // update all document     } ); or you can copy and paste this code above code is with comment that how mongoDB query works db.colleciton.update(     {         "active" : "yes"     },     {         $unset: {"Name":""}     },     {         "multi" : true     } );

EntityRef: expecting ';' error while creating the xml file?

This page contains the following errors: error on line 68 at column 18: EntityRef: expecting ';' Below is a rendering of the page up to the first error. Generally  this error occured when any value have & in the value between tag example:  <Name>PHP & C</Name> So & break the xml and due to this it shows the error just replace   & with  &amp   in your value field example:  $output .= "<Name>" . str_replace('&', '&amp;', $row['name']) . "</Name>"; I hope this will help you. If helped then dont forget to comment to inspire me :)

No hint path defined for [folder] in laravel?

No hint path defined for [folder] in laravel. There could be several reasone for this error in laravel. But most of time it works like a charm to solve this probelm - No hint path defined for If you will check your view file which you have include in your controller or routes. then  you will find that on view file you have some code like this in your view/file.php @extends('Folder::layouts.default') Or @include('Folder::includes.header') to pass the view in templates so where folder is mention you can change the folder  path where your file is located.

How to remove blank array from an array?

How to remove blank array  from an array? like: you have an array where a key is blank and you want to remove the array from the tree of array then you can use this function like: function unsetblankarray($array)     {         foreach($array as $key=>$value)         {             if(!@$array[$key]['field'])             {                 unset($array[$key]);             }         }         return $array; }

How to get the input value after validation failed in laravel 4?

You can get the particular input field after validation failed in laravel 4. simple use the old method with Input class to get the last inserted value of input box. $getvalue = Input::old("fieldName");

How to create a table via Artisan in laravel?

Create a table in database via Artisan in laravel Step1: First you need to go on your root directory Step2: php artisan migrate:make create_users_table paste this code into your command interface Step3: Check the file named 2014_mm_dd_114554_create_users_table.php in your Root\app\database\migrations folder Step4: There will be two method Up and Down paste this Schema in this method  public function up()     {         //         Schema::create('users', function($table)         {             $table->increments('id');             $table->string('email')->unique();             $table->string('name');             $table->timestamps();         });     }     /**      * Reverse the migrations.      *      * @return void      */     public function down()     {         //         Schema::drop('users');     } Step5: Run this command on your root directory php artisan migrate You  can check the database there will a

How to set flash message in laravel?

Set flash message in laravel You need to add this code in your controller Session::flash('loginerror', "Your Email-id or Password does not match."); return Redirect::to('login'); Now you need to add this code in your view section @if (Session::has('loginerror'))    <h2>{{ Session::get('loginerror') }}</h2> @endif