displays the right info but won't add to link
Posted: Sat Jan 31, 2004 12:36 pm
I am trying to get my script to display a list of items ready for download, and provide a link for each one. It requires a status to be set to 5.
The problem is I have to set the value of $la_download_link on each cycle of the product.
It should check for orders -> products -> file_name.
If there are multiple products in each order, it seems to be always selecting the first one.
For some reason each time it cycles it chooses the first item, atleast to add to the $la_download_link. I added echo" after each query to see what it was getting, and that seemed to be working fine. It displayed each product and filename as they should be.
Even down near the bottom, I added <TD>$file_name</td> to see what that displayed. It displayed each filename as it should be. Why won't it add the right file name into the $la_download_link?
Code: Select all
if ($status==5){ $status="$la_download_link";}Code: Select all
$la_download_link = "<a href="$site_url/files/$file_name">Download</a>";If there are multiple products in each order, it seems to be always selecting the first one.
For some reason each time it cycles it chooses the first item, atleast to add to the $la_download_link. I added echo" after each query to see what it was getting, and that seemed to be working fine. It displayed each product and filename as they should be.
Code: Select all
while ($row = mysql_fetch_array($sql_select)){
$order_id=$rowї"cart_order_id"];
$status=$rowї"status"];
$time=$rowї"time"];
$year=substr($rowї"date"],0,2);
$month=substr($rowї"date"],2,2);
$day=substr($rowї"date"],4,2);
$prod_total=$rowї"prod_total"];
$get_product = mysql_query("SELECT product FROM ".$prefix."store_order_inv WHERE cart_order_id='$order_id'");
$count = mysql_num_rows($get_product);while ($row = mysql_fetch_array($get_product)) {
$product = $rowї"product"];echo"$product<BR>";
$get_file_name = mysql_query("SELECT file_name FROM ".$prefix."store_inventory WHERE product='$product'");
$count = mysql_num_rows($get_file_name);
while ($row = mysql_fetch_array($get_file_name)) {
$file_name = $rowї"file_name"];echo"$file_name";
}
$la_download_link = "<a href="$site_url/files/$file_name">Download</a>";
if($date_style=="0")
{
$date="$month/$day/$year";}
// EU date format
if($date_style=="1")
{
$date="$day/$month/$year";}
if ($bgcolour ==$colour_3){
$bgcolour =$colour_4;}
elseif ($bgcolour ==$colour_4){
$bgcolour =$colour_3;}
if ($status==1){
$status="$la_order_pending";}
if ($status==2){
$status="$la_order_await_ship";}
if ($status==3){
$status="$la_order_shipped";}
if ($status==4){
$status="$la_order_declined";}
if ($status==5){
$status="$la_download_link";}
echo"<tr bgcolor="$bgcolour" align="center">
<td>$order_id</td>
<td>$status</td>
<td>$date - $time</td>
<td>$currency$prod_total</td>
<TD>$file_name</td>
<td align="center">
<table width="94" height="24" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="24" width="94" background="images/white_button.gif" align="center" valign="middle" style="cursor: hand;" onClick="location.href='view_order.php?order_id=$order_id'"><a href="view_order.php?order_id=$order_id"><font class="wht_btn">$la_more_info</font></a></td>
</tr>
</table>
</tr>";
}
}// end while