array problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robin1983
    New Member
    • Oct 2007
    • 99

    #1

    array problem

    Hi guys, actually i have a problem. I think its a very simple for all of you, but as i m begginer i m not able to do this. The problem is that, i access a particular column from a table with mysql query. Now, what i want to do is that, i want to put these value in an array.
    [PHP]
    include "config.inc.php ";
    include "connect.inc.ph p";

    $sql = mysql_query("SE LECT vFirstName FROM employeetable") or die(mysql_error ());
    if($sql)
    {
    // here i want to put all the data (vFirstName) into an array.
    }
    else
    {
    echo "Sorry";
    }
    but i dont know how to put these value into array. please help me. thanks in advance ...

    [/PHP]
  • MarkoKlacar
    Recognized Expert Contributor
    • Aug 2007
    • 296

    #2
    Hi Robin,

    You need to look at mysql_result to be able to solve what you describe.

    Good luck

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      mysql has it's own array: mysql_fetch_arr ay()

      For yours it would be

      [php]
      while($_row = mysql_fetch_arr ay($sql)
      {
      echo $_row['column_name_he re'] . "<br />";
      }
      [/php]

      Comment

      • robin1983
        New Member
        • Oct 2007
        • 99

        #4
        Originally posted by markusn00b
        mysql has it's own array: mysql_fetch_arr ay()

        For yours it would be

        [php]
        while($_row = mysql_fetch_arr ay($sql)
        {
        echo $_row['column_name_he re'] . "<br />";
        }
        [/php]
        thanks budy, i got it

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Originally posted by robin1983
          thanks budy, i got it
          Good to know!

          Kind regards.

          Comment

          Working...