Jump to content

alphacooler

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

alphacooler's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=388661:date=Jun 27 2006, 05:21 PM:name=thepip3r)--][div class=\'quotetop\']QUOTE(thepip3r @ Jun 27 2006, 05:21 PM) [snapback]388661[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code] $sql = "SELECT $column FROM $table"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) {   echo $row['$column']; }[/code] ...displays ALL columns for a specific query in a MySQL database and if you want to write those vars to an array to search: change "echo $row['$column']" to "$array[] = $row['$column']" [/quote] ThePip3r, thanks man could you tell me why this didn't work (which is what I had before) [code]     $myarray=array();     for ($i=0; $i<$num_results; $i++)     {         $username=$row['username'];         $myarray[]=$username;     } [/code]
  2. [!--quoteo(post=388642:date=Jun 27 2006, 03:57 PM:name=thepip3r)--][div class=\'quotetop\']QUOTE(thepip3r @ Jun 27 2006, 03:57 PM) [snapback]388642[/snapback][/div][div class=\'quotemain\'][!--quotec--] i'm assuming this is a column in a table in a database??? which database? if it's MySQL, use something like mysql_fetch_array() and RTFM. =D [/quote] mysql_fetch_array just creates an array with the data (in this case the username) in the first row. I need to combine all of the data from all of the rows into one array that can be searched.
  3. I am querying one column in a table and would like to create an array that holds all of the data in the rows of that column. Say the column contains usernames. I would like to have one array that has every username in it. How would I create that array? Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.