What Jacmoe seem to have done was to add [ code ][ /code ] (without the spaces) tags around your PHP code. That way your code is shown here in colors and with indentation. It makes it more readable for us. He did not change your actual code.
The first thing I would check is if both $alatan and $equipment are arrays, and if they are not empty. You can do that by temporarily adding the following code right above the table and viewing the page:
<?php var_dump($alatan, $equipment); ?>
There are two other things that I noticed. First a very small typo near the end:
// this line misses a character
echo $alatans>Equipment_Name . "<br />" . $alatans->Description . "</center></td>";
// it should read:
echo $alatans->Equipment_Name . "<br />" . $alatans->Description . "</center></td>";
Secondly, I am not sure if it is supposed to happen, but the second foreach loop (with $equipment) will never add more than one $aname to the table output. In that case I would suggest removing the <br /> at the end of that line. In fact, you probably don’t need most (if any at all) of the <br /> tags that are in your code now.
Finally, as far jayant’s comment is concerned. I think you should first try to get a basic table working, like you are trying now. CGridView is neat, but it means you need to have your models well in order. I’m not sure if that is the case here.
Btw, do you happen to have a link to that Youtube tutorial you mentioned? It may help in figuring out what is supposed to happen.
means that, i must remove all the <br /> tags? the tutorial video shown very fast way…he only paste the already coding that he done it…he did not show where the coding come from…huhuhu
I’m affraid I can’t really tell what is going wrong in your code right now. Is there any chance you could upload what you have so far so I can run it and play around with it a bit? If you don’t want to post it here in public, feel free to e-mail me instead. I will PM you my address. If you are okay with sharing, could you include:
[list=1]
[*]your webapp, but not the framework itself (to save size). Don’t forget to remove usernames and password from your config file!
[*]a database dump that can be imported
[/list]
If you are not okay with sharing, we really do need at least more information about what is in the $alatan and $equipment variables when your code is run. Could you then paste the result of the var_dump() I suggested above?
ok…i will send it to you…but u want all the file or how? i ont understand… did u means the php file only? or complete with the database? how should i paste the result of var_dump? u man print screen or what?
public function actionDetails()
{
if($_GET["id"]){
$equipmentCriteria = new CDbcriteria();
$equipmentCriteria ->select = "*";
$equipmentCriteria->condition = "Equip_ID = " . $GET["equipment"];
$this-> render('index', array('equipment' => Equipment::model()->findAll($equipmentCriteria) ));
}
else{
$this->message = 'Hello from Store.Details()';
$this->render('index', array('content'=>$this->message));
}
}
// Uncomment the following methods and override them if needed
/*
public function filters()
{
// return the filter configuration for this controller, e.g.:
return array(
'inlineFilterName',
array(
'class'=>'path.to.FilterClass',
'propertyName'=>'propertyValue',
),
);
}
public function actions()
{
// return external action classes, e.g.:
return array(
'action1'=>'path.to.ActionClass',
'action2'=>array(
'class'=>'path.to.AnotherActionClass',
'propertyName'=>'propertyValue',
),
);
}
*/
}
coding index.php in directory protected\views\store
I have a feeling that jacmoe’s and my request for information are getting mixed up a bit. Jacmoe, may I suggest that I let starry yii mail me the code and have me post the relevant bits here? You know, less noise - more signal…
Starry yii, I am going to ask you to do the following:
[list=1]
[*]copy the protected folder (the one where you keep your config, controllers, views and so on) to a temporary place
[*]in that temporary copy, edit protected/config/main.php so you remove all usernames and passwords (although I will ignore them if you happen to forget one)
[*]create a zip file of this temporary folder
[*]create a database dump and make a zip file out of it. If you use PHPAdmin, select the database for the store, click the export tab and save as a zip file.
[*]then sent both zip files to the e-mail address that I PM’ed you.
[/list]
I will take a quick look and post the code here that is relevant. Does that sound like a plan?
But the point is still valid: unless Starry Yii can find eager helpers who are willing to download and debug his code - or use their psychic powers to figure out what’s wrong - then he needs to learn how to ask for help.