Array Question

From: Date: Mon, 28 Jul 2003 17:16:48 +0000
Subject: Array Question
Groups: php.general 
Request: Send a blank email to php-general+get-157209@lists.php.net to get a copy of this message
hello everyone, I am trying to store one of the fields of the resultset into an array as I display the results. while ($row = mysql_fetch_array($result1)) {
        // Alternate the bgcolor of each row for visibility
            ($even % 2) == 0 ? $bgcolor = "#EFEFEF" : $bgcolor = "#eeffff";
                $even = $even + 1;
        // print the actual row
               echo   "<TR BGCOLOR=$bgcolor>
  <TD align=\"left\"><font color=\"#666666\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">$row[company]</font></TD>
  <TD align=\"left\"><font color=\"#666666\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">$row[name_1]</font></TD>
  <TD align=\"left\"><font color=\"#666666\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">$row[phone_1]</font></TD>
 <TD align=\"left\"><font color=\"#666666\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">$row[city]</font></TD>
 <TD align=\"left\"><font color=\"#666666\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">$row[url]</font></TD>
  <TD align=\"left\"><font color=\"#666666\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">$row[email_1]</font></TD>
 <TD align=\"center\"><font color=\"#333333\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\"><a href=\"full-profile.php?name=".$row['company']."\">--Link--</a></font></TD>
</TR>"; // try to store the name of the company in an array called companyname $companyname = array($row['company']);
		     // try to register the variable
		     $_SESSION['link'] = $companyname;
//$_SESSION['link'] = $row[company];
        } // end while
I am trying to store the variable $row['company'] into a array called companyname[], so that I am able to register it as a session variable and use it on subsequent pages. I keep getting errors and am not able to store the values in array $row['company'] . I would appreciate if someone could throw some light on this. Thanks in advance. --Pushpinder

« previous php.general (#157209) next »