hoachen Posted October 28, 2006 Share Posted October 28, 2006 Hi guys is me again. This time i really can't figure out how to display the article in details according to the 'id' assigned on database. I have a page that will display all the results with the status of 'approval' and this page only display partial details for each article (this page is working fine). If the user would like to read more about this article they will click on "View More" link and open a new windows that will display the detail according to which article they click on. Right now, on the browser, the id is correctly diplay but it display all the articles include not the id that they select.What wrong on the below code? Your advise is appreciate.$objData = new PReport($db);$id = $_GET['id'];$sWhere = "WHERE id = '$id'";$objDataload(false, false, $sWhere);<?php while ($res = $objData->fetch()) { $app=$res->getStatus(); if($app =='pending' || $app=='cancelled') { echo ''; } else { ?> <tr> <td class="txtRegular" style="border-bottom:#999999 solid 1px"><?php echo " ". $res->getID(); ?></td> <td height="36" class="txtRegular" style="border-bottom:#999999 solid 1px"><?php echo " ". $res->getDate(); ?></td> <td style="border-bottom:#999999 solid 1px" class="txtRegular"><?php echo " ". $res->getCity();?></td> <td style="border-bottom:#999999 solid 1px" class="txtRegular"><?php echo " ". $res->getState();?></td> <td style="border-bottom:#999999 solid 1px" class="txtRegular"><?php echo " ". $res->getDetails();?> </td></tr> <?php } } ?> Link to comment Share on other sites More sharing options...
jhecht Posted October 28, 2006 Share Posted October 28, 2006 <?php$objData = new PReport($db);$id =(int)$_GET['id'];$sWhere = "WHERE id = $id";//integers dont need quotes around them$objData->load(false, false, $sWhere);//Im assuming objDataload was meant to be objData->loadwhile ($res = $objData->fetch()){$app=$res->getStatus();if($app =='pending' || $app=='cancelled'){echo '';}else{ ?><tr><td class="txtRegular" style="border-bottom:#999999 solid 1px"><?php echo " ". $res->getID(); ?></td><td height="36" class="txtRegular" style="border-bottom:#999999 solid 1px"><?php echo " ". $res->getDate(); ?></td><td style="border-bottom:#999999 solid 1px" class="txtRegular"><?php echo " ". $res->getCity();?></td><td style="border-bottom:#999999 solid 1px" class="txtRegular"><?php echo " ". $res->getState();?></td><td style="border-bottom:#999999 solid 1px" class="txtRegular"><?php echo " ". $res->getDetails();?> </td></tr><?php }}?> for the love of god look up hereDoc syntax. I hate it when while's have code split between 2 sections of php code. Its just ugly to have to read and go through. look up here doc, please.If that doesnt work then you may need to post up the code for the definitions of PReport Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now