Menu

[Solved] C Sample Code Model Filename User Modelphp Db Query Select Note Notes Nsquery Numrows N0 R Q37280867

(c) Below is a sample code for a model with filename User model.php <?php class User model extends CI Model f public functionBelow is a sample code for a controller with filename User.php. <?php class User extends CI Controller public function indexAssume you have a database with a table called Notes, which has a single column named note. This table has only the follo(c) Below is a sample code for a model with filename User model.php <?php class User model extends CI Model f public function calculate (sinput) ( Squery $this->db->query (“SELECT note FROM Notes;”); nSquery->num_rows ) if ($n0) return 0 $counter-0 foreach (squery->result array) as Srow) f if (Scounter Şinput) ( strlen ( $ row [ ‘ note ‘ ] ) ; $sum +-# Scounter++; $data-array) sdata[ ‘output’$sum/$n; return $data; Below is a sample code for a view named view user.php. <html> <body> The output is <?php echo Soutput ?> </body </html> Below is a sample code for a controller with filename User.php. <?php class User extends CI Controller public function index ) echo “This is the index page” public function run ($id-NULL) ( if (SidNULL) [ echo “Cannot be null.” return; sthis->load->model (‘User_model’) şdata Sthis->User_model->calculate (Sid); şthis->load->view (‘View user, Sdata) Assume you have a database with a table called “Notes”, which has a single column named “note”. This table has only the following 3 entries: “Eat”, “Sleep”, “Shop”. Also, assuming that ‘ci is the folder where Codelgniter is installed, and that the above code compiles and runs with no errors, answer the following questions. ) What would be the output of the html page with the following URL: [4 marks] http://raptor.kent.ac. uk/-mk451/ci/index.php/user/run/ What would be the output of the html page with the following URL: (ii) [4 marks] http://raptor.kent.ac.uk/~mk451/cǐ/index.php/user/run/1/ (ii) What would be the output of the html page with the following URL: http://raptor.kent.ac.uk/-mka51/ci/index.php/user/run/3/ 14 marks] (iv) What would be the output of the html page with the following URL: [4marks] http://raptor.kent.ac.uk/mk451/cǐ/index.php/user/run/o/ Show transcribed image text (c) Below is a sample code for a model with filename User model.php

Expert Answer


Answer to (c) Below is a sample code for a model with filename User model.php … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *