/    Sign up×
Community /Pin to ProfileBookmark

unable to get correct output after compare and replace

table slabpay
——————————————————-


agent_id|agent_name|cust_id|cust_name|installment_amt|
——————————————————-


1 |mike |1 |john |350 |
——————————————————-


1 |mike |1 |john |400 |
——————————————————


1 |mike |2 |abraham |350 |
——————————————————-


1 |mike |1 |john |000 |
——————————————————-


1 |mike |2 |abraham |000 |
——————————————————-


1 |mike |2 |abraham |450 |
——————————————————-

mysql query
——————————————————

`$select = mysql_query(“SELECT cust_id, cust_name,installment_amt FROM slabpay WHERE agent_id=1”);`

result should be
——————————————————


cust_id | installment_amt
——————————————————-

1,john ,350,400,000

2,abraham ,350,000,450
——————————————————

$b = array(350,400,450); //pre-defined installment amount values

compare $b with installment_amt of each customer replace matching values with 000 in array $b and print result of cust_id 1 all values 000,000,450 again repeat and print cust_id 2 so on…

i am new to php mysql please help me to solve this problem

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @blueguy777 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...