sanjay_zed Posted July 20, 2012 Share Posted July 20, 2012 i have one table called ptl_temp_DEPMAS . there is one column named LEDCOD..the values for this column would be savings account as DPO1, recurring account as DP02, fixed account as DP03.. i need to run a query such a way that the result of query needs to be displayed in drop down box as accountno-accounttype example: 1 savings account 2 savings account 3 recurring account 10 fixed account guys this is my requirement..i am not getting how to write query and put condition. WHAT I TRIED IS $SQL=select DEPNUB from ptl_temp_DEPMAS where MEMNUB='123'. HERE i can able to retrieve account no i.e DEPNUB . I NEED TO CONCATENATE "LEDCOD" along with this not as it is stored in database e.g DP01...I NEED TO DISPLAY AS SAVINGS BANK.. Link to comment https://forums.phpfreaks.com/topic/265983-fetching-problem-in-mssql/ Share on other sites More sharing options...
xyph Posted July 20, 2012 Share Posted July 20, 2012 You're going to need to hard-code some sort of translator for this, unless it's stored somewhere. <?php $translation = array( 'DP01' => 'Savings', 'DP02' => 'Recurring', 'DP03' => 'Fixed' ); $LEDCOD = 'DP02'; // Here's how you'd check // First, verify a translation exists if( isset($translation[$LEDCOD]) ) { // Then output the translation echo "This is a {$translation[$LEDCOD]} Account"; // Otherwise, report that no translation was found } else { echo "This is an unknown account type ($LEDCOD)"; } ?> Link to comment https://forums.phpfreaks.com/topic/265983-fetching-problem-in-mssql/#findComment-1363111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.