0

我在下面有一个查询脚本,它为特定用户的发票提取一行数据。我正在尝试让脚本能够具有指向上传文件的链接,以便它可以下载/显示(第 17 行发票上传sal.npc_image_upload)。

文件名看起来不错,但我不确定如何实际为它创建链接?

        <?php
        require_once ('/database.php'); // Connect to the db.

        // Retrieve the user's and inovoice information.
        $query = "SELECT us.sp_user_id, us.sp_firstname, us.sp_surname, us.sp_amb_club_no, sal.npc_item_id, sal.sp_user_id, sal.npc_battery_n_code , sal.npc_battery_other_code , sal.npc_ft_part_no, sal.npc_quantity, sal.npc_customer_name, sal.npc_registration_no , sal.npc_suo_no, sal.npc_amb_club_no, sal.npc_repair_order, sal.npc_invoice_no, sal.npc_entry_userdate, sal.npc_image_upload, sal.npc_usertype, sal.npc_points, sal.npc_bonus_points , sal.npc_active  
                 FROM sp_user AS us, npc_sales_list AS sal
                 WHERE sal.npc_item_id=$id
                 AND us.sp_user_id = sal.sp_user_id";

        $result = mysql_query ($query) or die(mysql_error());
        if (mysql_num_rows($result)) { // Valid user ID, show the form.

            // Get the user's information.
            $row = mysql_fetch_array ($result, MYSQL_NUM);
            echo '<h1>Invoice Number: ' . $row[15] . ' </h1><br />
            <table width="450" border="0" cellspacing="1" cellpadding="7" style=" padding:0px 0px 0px 7px;">
            <tr bgcolor="#eaeced">
            <td><div align="right"><strong>N-Club Part Number:</strong></div></td>
            <td width="200">' . $row[6] . '</td>
            </tr>
            <tr bgcolor="#d4d9df">
            <td><div align="right"><strong>Other Part Number:</strong></div></td>
            <td>' . $row[7] . '</td>
            </tr>
            <tr bgcolor="#eaeced">
            <td><div align="right"><strong>Fuel Treatment:</strong></div></td>
            <td>' . $row[8] . '</td>
            </tr>
            <tr bgcolor="#d4d9df">
            <td><div align="right"><strong>Quantity:</strong></div></td>
            <td><strong>' . $row[9] . '</strong></td>
            </tr>       
            <tr bgcolor="#eaeced">
            <td><div align="right"><strong><strong>Customer Name</strong></div></td>
            <td>' . $row[10] . '</td>
            </tr>
            <tr bgcolor="#d4d9df">
            <td><div align="right"><strong><strong>Registration Number:</strong></div></td>
            <td>' . $row[11] . '</td>
            </tr>
            <tr bgcolor="#eaeced">
            <td><div align="right"><strong>SUO Number:</strong></div></td>
            <td>' . $row[12] . '</td>
            </tr>
            <tr bgcolor="#d4d9df">
            <td><div align="right"><strong>A-Club No.</strong></div></td>
            <td>' . $row[13] . '</td>
            </tr>
            <tr bgcolor="#eaeced">
            <td><div align="right"><strong>Repair Order</strong></div></td>
            <td>' . $row[14] . '</td>
            </tr>
            <tr bgcolor="#d4d9df">
            <td><div align="right"><strong>Invoice Date</strong></div></td>
            <td>' . $row[16] . '</td>
            </tr>
            <tr bgcolor="#eaeced">
            <td><div align="right"><strong>Invoice Upload</strong></div></td>
            <td>' . $row[17] . '</td>
            </tr>
            </table>
            <br><br>
            <p><a href="viewsale.php"> << Back to Logged Sales</a></p>
            ';

        } else { // Not a valid user ID.
            echo '<h1 id="mainhead">Page Error</h1>
            <p class="error">This page has been accessed in error.</p><p><br /><br /></p>';   
        }

        mysql_close(); // Close the database connection.
        ?>
4

0 回答 0