Page 1 of 1

Help.....displaying variable in HREF

Posted: Mon Jun 23, 2003 12:27 pm
by polosport6699
I have this code printed out with alternating rows, and I cannot get the code to display the varible $jcode in the html <a href=?cmd=$jcode> to display an automatic link. Jcode is the unique mysql identifyer key

Code: Select all

$query = "SELECT jcode, designation, responsibilities, city, posted FROM listing WHERE listing.status = 'yes' ORDER BY $order_by";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query1. " . mysql_error());
list($jcode) = mysql_fetch_row($result);
if(mysql_num_rows($result)) {
  $rank = 1;
  while($row = mysql_fetch_row($result)) 
  {
    print("</tr><tr>");
    if($color == "#FFFFFF") {
     $color = "#DFDFDF";
    } else {
      $color = "#FFFFFF";
    }

   print("<td width="5px" bgcolor="$color"><center><small>");
   print("<font face="Verdana">$rank</font></small></center></td>");
   print("<td width="75px" bgcolor="$color"><left><small>");
   print("<font face="Verdana"><a href=?cmd=$jcode>$row[1]</font></a></small></center></td>");
   print("<td width="235px" bgcolor="$color"><small>");
   print("<font face="Verdana">$row[2]</font></small></center></td>");
   print("<td width="75px" bgcolor="$color"><left><small>");
   print("<font face="Verdana">$row[3]</font></small></left></td>");
   print("<td width="85px" bgcolor="$color"><left><small>");
   print("<font face="Verdana">$row[4]</font></small></left></td>");
  $rank++;
			}
		}
}

Posted: Mon Jun 23, 2003 12:47 pm
by jason
Are you sure $jcode contains what you think it does? After you do list($jcode), do a var_dump($jcode); and see if it's the value you think it should be.