Jump to content

fetching problem in mssql


Recommended Posts

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

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)";
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.