Created
April 2, 2017 13:42
-
-
Save Rameshwar-ghodke/b19b3339837a1399330e9492c9b7de29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// insert into stud table value using codegnitor | |
$data = array( | |
'roll_no' => ‘1’, | |
'name' => ‘Virat’ | |
); | |
$this->db->insert("stud", $data); | |
// Update query using codegnitor | |
$data = array( | |
'roll_no' => ‘1’, | |
'name' => ‘Virat’ | |
); | |
$this->db->set($data); | |
$this->db->where("roll_no", ‘1’); | |
$this->db->update("stud", $data); | |
// Delete using codegnitor | |
$this->db->delete("stud", "roll_no = 1"); | |
//Use the following code to get all the records from the database. | |
// The first following statement fetches all the records from “stud” table and returns the object, | |
which will be stored in $query object. | |
//The second statement calls the result() function with $query object to get all the records as array. | |
as - | |
$query = $this->db->get("stud"); | |
$data['records'] = $query->result(); | |
$this->db->close(); // close the connection. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment