www.webdeveloper.com
Results 1 to 3 of 3

Thread: Find row in Recordset and Show it.

Hybrid View

  1. #1
    Join Date
    Nov 2012
    Posts
    13

    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 recordNext and recordPrevious. This is the way to move through the recordset.
    I need to include a TextBox for the user to enter the "customer code" and:
    1) Search the client in the recorset using that code.. (find the row for that customer)
    2) Position recodset in that row and display the data for that customer.

    Any ideas?

    Thanks in advance.

  2. #2
    Join Date
    Jul 2007
    Location
    Wisconsin
    Posts
    468
    Can you change the query that's pulling the recordset to get just the row needed?

    PHP Code:
    $query "SELECT `name`, `code`, `age`, `address` FROM `table` WHERE `code` = '"$searchCode ."';"

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

    PHP Code:

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


  3. #3
    Join Date
    Nov 2012
    Posts
    13
    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 "findfirst" in ADO recordset when working with Access...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles