Try this.

$companyname[] = $row['company'];


Jim Lucas
----- Original Message ----- 
From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 10:16 AM
Subject: [PHP] Array Question


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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to