/    Sign up×
Community /Pin to ProfileBookmark

Find row in Recordset and Show it.

Hello friends, I need a help …

I’m working with PHP, MySql and Dreamweaver, I have defined a recordset that loads data from a “customer” table. The records are displayed (name, code, age, address, etc) one by one (1 record= 1 Customer).
I have buttons for [U]recordNext [/U]and [U]recordPrevious[/U]. This is the way to move through the recordset.
I need to include a [B]TextBox [/B]for the user to enter the “[B]customer code[/B]” and:
1) [B][U]Search [/U][/B]the client in the recorset using that code.. (find the row for that customer)
2) [B][U]Position [/U][/B]recodset in that row and display the data for that customer.

Any ideas?

Thanks in advance.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@OctoberWindNov 16.2012 — Can you change the query that's pulling the recordset to get just the row needed?

[code=php]
$query = "SELECT name, code, age, address FROM table WHERE code = '". $searchCode ."';";
[/code]



Otherwise, you might have to loop through the entire recordset and dig out the one you need:

[code=php]

foreach ($recordSet as $key => $record) {
if ($record["code"] == $searchCode) {
// do something with $recordSet[$key]
}
}

[/code]
Copy linkTweet thisAlerts:
@sinchanauthorNov 17.2012 — Octobewind Thanks for response. I no need to redo the query, I have a query that loads the recordset, I need to search inside the recordset (table customers) and position in the record found and continue to browse the table. Something similar to "[B]findfirst[/B]" in ADO recordset when working with Access...
×

Success!

Help @sinchan 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 4.28,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...