Bluehost.com Web Hosting $6.95

Array Question

This is a discussion on Array Question within the PHP General forums, part of the PHP Programming Forums category; hello everyone, I am trying to store one of the fields of the resultset into an array as I display ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-28-2003
Pushpinder Singh Garcha
 
Posts: n/a
Default 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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:03 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0