Development mysql_fetch_assoc calls

Discussion in 'Software' started by Draxin, 1 Oct 2007.

  1. Draxin

    Draxin Seeker of Photons

    Joined:
    29 Nov 2001
    Posts:
    965
    Likes Received:
    5
    is it possible to call an mysql_fetch_assoc the same way you would call a multi dem array

    ex.
    $foo = mysql_fetch_assoc($sql_foo);
    $foo['col1']['2'];


    I have looked through the docs and have found no mention
     
  2. DougEdey

    DougEdey I pwn all your storage

    Joined:
    5 Jul 2005
    Posts:
    13,933
    Likes Received:
    33
    How do you mean?

    result1 => ("a", "b", "c")
    result2 => ("e", "f", "g")

    you want to get the 2nd result of col 1 (result2.1)?

    If so, not really. mysql_fetch_assoc gets each result to an assoc array then moves the internal pointer along by one.

    Two options:

    1) Loop round dumping to an array, duplicating data and may be annoying.

    2) use mysql_data_seek() to move the internal result pointer.

    If you mean how is the result output, you get an array which gives the results as so

    result1 => (1->"a", 'col1'->"a", 2->"b", 'col2'->"b", 3->"c", 'col3'->"c")

    so you can use $result[1] or $result['col1']
     

Share This Page