Showing posts with label Yii. Show all posts
Showing posts with label Yii. Show all posts

2012-09-12

Call MySQL Stored Procedure via Yii Framework



1:  $command = Yii::app()->db->createCommand('CALL sp_MyStoredProcedure (  
2:       :v_id,  
3:       :v_createBy,  
4:       :v_title )');  
5:  $command->bindValue('v_id', NULL);   
6:  $command->bindParam('v_createBy', Yii::app()->user->id);   
7:  $command->bindParam('v_title', $_POST['Title']);  
8:  $result = $command ->execute();  

Finally, I can insert/update a form data into MySQL database successfully.

And I have to try another 2 things

1. get result from Stored-Procedure. (get 'LAST_INSERT_ID()' in Inserting case and get the number '1' in Updating Case, otherwise get the number '-1' to mean failed.)

2. package the result and the message into JSON format and response back to the front-end. It's supposed to follow Yii framework's style.

2012-09-08

A Sprint in My Program


Coding with my coworker, from HK. He is very experienced in some big projects and systems. I'm so pleasure to be his partner and work with him. Most of time we speak English unless I couldn't understand what he said again and again...

Today, finally, the front-end, Extjs UI, communicated with back-end, Yii, successfully. Next step is to make a MySql Stored-Procedure for creating and updating.

Afterwards, I went to the studio "You Paint I Fire". I couldn't understand what the master told me very well and so I made him speak 2-3 times.....sorry. ><
In spite of that, I'm always feel comfortable to work here. It's part of my life here and I like this job and my master.

Still, sometimes I got a little bit depressed before and after work cus of English...