Sunday 17 May 2015

Multiple Update in codigniter

View

<form name="form1" method="post" action="<?php echo base_url('route/update'); ?>">
<table class="table table-striped" id="table-example">
<thead>
<tr>
<th  class="text-center">Rendering engine</th>
<th class="text-center">Browser</th>
<th class="text-center">Platform(s)</th>
<th class="text-center">Engine version</th>
<th class="text-center">CSS grade</th>
</tr>
</thead>
<tbody align="center">
<?php 
foreach($row as $rows){
$id=$rows->id;
?>
   <input type='hidden' name='ids[]' value='<?php echo $id;?>' />
<tr class="gradeU">

<td><input type='text' name='city[]' value='<?php echo $rows->route_city;?>' /></td>
<td><input type='text' name='name[]' value='<?php echo $rows->RouteName;?>' /></td>
<td>-</td>
<td class="center"><?php echo "<a href=".base_url().'route/editroute/'.$id.">".$id."</a>";?></td>
<td class="center"><?php echo "<a href=".base_url().'route/deleteroute/'.$id.">".$id."</a>";?></td>
</tr>
<?php 
}
?>
</tbody>
</table>
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="Reset" value="Reset" />
</form>

Model

function getRoute(){
$data=$this->db->query("select * from route_master");
return $data->result();
}


Controller

//for display data

public function index()
{
$data['row']=$this->model_registration->getRoute();
$this->load->view("registration/view_route",$data);
}

//for update

public function update(){
$data  = array();
for($i = 0; $i < count($_POST['ids']); $i++) {
    if($_POST['ids'][$i] != '') {
        $data[] = array(
            'id' => $_POST['ids'][$i],
            'route_city' => $_POST['city'][$i]
            );
    }
}
$linksCount = count($data);
if($linksCount) {
   // $this->db->where('id','id');
    //$this->db->insert_batch('route_master', $data);
    $this->db->update_batch('route_master', $data, 'id');
}
redirect('route/index');
}

Friday 8 May 2015

Codigniter

  1. CodeIgniter is an open source rapid development web applicationframework, for use in building dynamic web sites with PHP.


CodeIgniter is loosely based on the popular Model-View-Controller development pattern. While controller classes are a necessary part of development under CodeIgniter, models and views are optional.

CodeIgniter logo
Original author(s)EllisLab
Developer(s)British Columbia Institute of Technology
Initial releaseFebruary 28, 2006
Stable release3.0.0 / March 30, 2015
Preview release3.0rc3 / March 11, 2015
Development statusActive
Written inPHP
Operating systemCross-platform
TypeWeb application framework
LicenseMIT License

Why CodeIgniter?


Framework with a small footprint
CodeIgniter 3 has a 2MB download, including the user guide.
Clear documentation
The CodeIgniter User Guide comes with the download. It contains an introduction, tutorial, a number of "how to" guides, and then reference documentation for the components that make up the framework.
Compatibility with standard hosting
CodeIgniter 3 only needs PHP 5.2.4, and plays nicely with almost all shared or dedicated hosting platforms. Many webapps need a database, and CodeIgniter supports the most common, including MySQL.
No restrictive coding rules
Use your own coding and naming conventions, with only a few caveats that deal with classname conflicts. CodeIgniter looks to empower you, not shackle you.
Simple solutions over complexity
CodeIgniter encourages MVC, but does not force it on you.
Exceptional performance
CodeIgniter consistently outperforms most of its competitors.
No large-scale monolithic libraries
CodeIgniter is not trying to be all things to all people. It is a lean MVC framework, with enough capabilities to improve your productivity, while providing for third-party addons/plugins for additional functionality.
Nearly zero configuration
Much of the CodeIgniter configuration is done by convention, for instance putting models in a "models" folder. There are still a number of configuration options available, through scripts in the "config" folder.
No need for template language
CodeIgniter comes with a simple, substitution based, templating tool. Addons/plugins are available for most of the full-blown templating engines, if that is what you are used to.
Spend more time away from the computer
Don't we all want it? CodeIgniter is easy to learn and to get proficient with.


CodeIgniter is a community-developed open source project,
with several venues for the community members to gather and exchange ideas.

Installation of Drop Box API on Codigniter

As with the YouTube API the first step in getting this sucker setup is getting a developer key by visiting  https://www.dropbox.com/develop...