[Solved] Output last 5 rows in database [CakePHP] [closed]

You have to use find() Other way is to use query() $alltext = $this->Text->find(‘all’, array(‘limit’ => 5,’order’=>array(‘id DESC’))); <?php foreach ($alltextext as $text): ?> // format as necessary <td><?php echo $text[‘Text’][‘id’]; ?></td> // add others here <?php endforeach; ?> 3 solved Output last 5 rows in database [CakePHP] [closed]

[Solved] How to set array data posted as dropdown list in key value format [closed]

$array_list=array(array(“value”=>0,”text”=>”–Select–“),array(“value”=>268,”text”=>”Cash received”)); $selected=268; $text=””; foreach($array_list as $entry){ if($entry[‘value’]==$selected){ $text=$entry[‘text’]; break; } } echo “Selected Option: “.$text; Text will now contain the selected option, if I understood your question correct. 4 solved How to set array data posted as dropdown list in key value format [closed]

[Solved] How to prevent SQL injections in manually created queries?

I dont want to use other method You should use whatever provides the required functionality, not the method that you like more over others! Also you should never access superglobals directly in CakePHP, this will only bring you in trouble, especially in unit tests. User the proper abstracted methodes provided by the request object, that … Read more