CodeIgniter Laravel PHP Example Javascript jQuery MORE Videos New

Difference between result() and row() in codeigniter


result() To fetch multiple records from the database table we need to use result().

row()To fetch a single record from the database table we need to use row().

Example:

result():

$query = $this->db->query("YOUR QUERY"); 

$data=$query->result();

foreach ($data as $row) { 

echo $row['title']; 

echo $row['name']; 

echo $row['body']; 

}

row()

result():

$query = $this->db->query("YOUR QUERY"); 

if ($query->num_rows() > 0) { 

$row = $query->row_array();


echo $row['title']; 

echo $row['name']; 

echo $row['body'];


Warning: mysqli_connect(): (HY000/1040): Too many connections in /www/wwwroot/studentstutorial.com/demo/conn/conn.php on line 15
Could not Connect My Sql:Too many connections