Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get the id from the second row? (Mysql)

  • Hi,

    I have a query and it shows me 5 results

    Now, I always need the id from row 2 (result 2). How to get it?

    Greetz

Viewing 3 replies - 1 through 3 (of 3 total)

  • chrishajer
    Participant

    @chrishajer

    How are the results ordered now? How about showing the SQL?

    I am at work so can’t show the query :)

    The results are always different, but I need the id from the sec row no matter what the outcome is…

    So sometimes it’s:

    Row 1 – id 23 – tekst

    Row 2 – id 12 – tekst

    Row 3 – id 44 – tekst

    etc

    Or sometimes it’s:

    Row 1 – id 7863 – tekst

    Row 2 – id 56557 – tekst

    Row 3 – id 665 – tekst

    etc

    $data = $bbdb->query('stuff');
    $what_you_want = $data[1]->column_name;

    If I recall correctly.

    $data[1] should be the second item (0-based arrays), which is an object. Access its property by the name of the column the ID is stored in. bbdb is based on ezSQL. Look for some documentation. It’s actually pretty well documented for wpdb; did you not find anything there?

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.