Archive for April, 2010
function get_all_students() { $query = $this->db->get(‘students’); if ($query->num_rows() > 0) { $result = $query->result_array(); return $result; } else { return ’0′; } } // students is the table name of database For details you may visit http://codeigniter.com/user_guide/database/active_record.html[ READ MORE ]
function add($input) { $student_data = array( ‘name’ => $input['name'], ‘roll’ => $input['roll'] ); $test = $this->db->insert(‘students’, $student_data); // Produces: INSERT INTO student (name, roll) VALUES (‘name’, ‘roll’)[ READ MORE ]
<?php foreach($students as $row): ?> <tr> <td ><?php echo $row['name'];?></td> <td ><?php echo $row['roll'];?></td> /* Creating link on Edit */ <td><?php echo anchor(‘students/edit/’.$row['id'],’Edit‘);?></td> /* Student is Controller name and Edit is the function if controller */ </tr> <?php endforeach; ?>[ READ MORE ]
/* <form method="post" action="<?= site_url('Controller_name/ Controller_function').'/'.$student['id']; ?>"> <h1>Add information of Data</h1> <input type="text" name="name"> <lable>Name</label> <input type="text" name="roll"> <label>roll</label> <input type="submit" name="submit" value="submit"> </form> *[ READ MORE ]
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
Join 7 other followers
Get every new post delivered to your Inbox.