Yii Framework Forum: Show Record - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Show Record Show Record on Textbox Rate Topic: -----

#1 User is offline   karthik123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 23-November 12
  • Location:Tamilnadu,coimbatore,India

Posted 26 November 2012 - 11:23 PM

Hi
This is my sample code

<?php echo $form->textField($model,'LastName');?>


How Show records getting from Db and show on Text filed
0

#2 User is offline   Ujjwal Prajapati 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 47
  • Joined: 24-April 12

Posted 26 November 2012 - 11:59 PM

In your controller,

$model = YourClass::model()-> find();


Modify that with your requirements.

Now, in view, your code should show the value of Lastname.
0

#3 User is offline   karthik123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 23-November 12
  • Location:Tamilnadu,coimbatore,India

Posted 27 November 2012 - 04:51 AM

View PostUjjwal Prajapati, on 26 November 2012 - 11:59 PM, said:

In your controller,

$model = YourClass::model()-> find();


Modify that with your requirements.

Now, in view, your code should show the value of Lastname.




thanks for your reply..Don't mistake me i can't get idea
View page
<?php
$form=$this->beginWidget('CActiveForm',array(
'id'=>'student-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true),
) );
?>
<table width="100" border="1">
<tr>
<td><?=$form->labelEx($model,'UID');?></td>
<td><?php echo $form->textField($model,'UID');?></td>
<td><?php echo $form->labelEx($model,'UserName');?></td>
<td><?php echo $form->textField($model,'UserName');?></td>
<td><?php echo $form->labelEx($model,'type');?></td>
<td><?php echo $form->dropDownList($model,'type',array('2'=>'AND','1'=>'OR'));?></td>
</tr>
<tr>
<td><?php echo $form->labelEx($model,'Name');?></td>
<td><?php echo $form->textField($model,'Name');?></td>
<td><?php echo $form->labelEx($model,'Mobile');?></td>
<td><?php echo $form->textField($model,'Mobile');?></td>
<td><?php echo $form->labelEx($model,'Email');?></td>
<td><?php echo $form->textField($model,'Email');?></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><?php echo CHtml::submitButton('Search');?></td>

</tr>
</table>

<table width="100%" border="0" cellspacing="1" cellpadding="0" id="example">
<thead><tr>
<th>Edit</th>
<th>UID</th>
<th>Name</th>
<th>Gender</th>
<th>Contact</th>
<th>Email Id</th>
<th>Ishanga</th>
<th>Verify</th>

</tr>
</thead>
<tbody>
<?php
if(!empty($rows))
foreach($rows as $row){ ?>
<tr>
<td>
<?php //echo $form->hiddenField($model,'HeaderCode');

//echo CHtml::submitButton('Edit',array('title'=>"View",'onclick'=>'js:editTest();'));
$id = $row['Header_Code']; ?>

<?php echo CHtml::button('Edit', array('name'=>'demandeVersement','onclick'=>"js:editTest($id);")
);?>


</td>
<td><?php echo $row['IVC_Code'];?></td>
<td><?php echo $row['Name'];?></td>
<td><?php if($row['Gender'] == 0)echo 'Female'; elseif($row['Gender'] == 1) echo 'Male';?></td>
<td><?php echo $row['Contact1'];?></td>
<td><?php echo $row['Emailid'];?></td>
<td><?php echo $row['Category'];?></td>
<td><?php echo $row['verify'];?></td>

</tr>
<?php }?>
</tbody>
</table>

Model Page
public function Singleview($head)
{

$connection = Yii::app()->db;
$sql = "[sp_IvcView] :Header_Code";
$command = $connection->createCommand($sql);
$command->bindParam(":Header_Code", $head, PDO::PARAM_INT);
$rows = $command->queryAll();
return $rows;
}

Controller page
public function actionIvcview()
{

$view = new Searchishanga();
$model = new ViewTest();

$head = $_GET['headerCode'];
//$rows = $views->Singleview($head);
$rows = $view->Singleview($head);

$this->render('Singleview',array('model'=> $model,'rows'=> $rows));
}

Not working properly
help once
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users