[Solved] execute query with cakephp [closed]

you ca us this code $mat=$this->Materiel->Paiement->query(” select *,materiel_id , SUM(paiements.quantite) as t from paiements ,materiels where paiements.materiel_id=materiels.id GROUP BY materiel_id ORDER BY sum(paiements.quantite) desc “); Ajust this code for your model 1 solved execute query with cakephp [closed]

[Solved] Cakephp routing (in PHP too) [closed]

As indicated in the docs, you can use regular expressions to restrict matching route elements. The regex snippet you are looking for is: ‘(?i:hellouser)’ Route definition Putting the docs and your specific regex together, here’s a route that will match the url /hellouser in a case insensitive manner: Router::connect( ‘/:user’, array(‘controller’ => ‘teachers’, ‘action’ => … Read more

[Solved] how to upload image in cakephp2.5+ and store it in webroot folder [closed]

Use following echo $this->Form->create(‘Tour’,array(‘autocomplete’ => ‘off’,’enctype’=>’multipart/form-data’)); Allows image/video data to be processed. Inside controller if ($this->request->is(‘post’)) { if(is_uploaded_file($this->request->data[‘Tour’][‘varbigimg’][‘tmp_name’])) { $fileNameFull = $this->request->data[‘Tour’][‘varbigimg’][‘name’]; $oldFile=”../../app/webroot/img/”.$fileNameFull; move_uploaded_file( $this->request->data[‘Tour’][‘varbigimg’][‘tmp_name’], $oldFile ); $this->Tour->create(); $this->request->data[‘Tour’][‘varbigimg’] = $fileNameFull; //HERE you need to specify same for thum $this->request->data[‘Tour’][‘varthumimg’] = $fileNameFull; ////HERE you need to specify same for thumbfield if ($this->Tour->save($this->request->data)) { $this->Session->setFlash(__(‘Your possstt … Read more

[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