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

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.