Jump to content

phpjordan

New Members
  • Posts

    1
  • Joined

  • Last visited

phpjordan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All, this is my first post on here so please go easy! I am creating a portal type application, I have a page that has a table on with a list of customers in, but I want to link the customer name to a new page that gives me a list of that customers products, I have it working where I am setting the customer ID in the SQL WHERE clause but I want to do this dynamically so when a user clicks on customer 1 its customer 1's products that are loaded etc. Here is the first table: SQL: $customerList = "SELECT T0.CardCode, T0.CardName FROM OCRD T0 WHERE T0.SlpCode = 947"; $myCustomers = sqlsrv_query( $sapconn, $customerList); HTML/PHP: <table> <thead> <tr> <th>SLP Code</th> <th>SLP Name</th> </tr> </thead> <tbody> <?php while($customer = sqlsrv_fetch_array($myCustomers, SQLSRV_FETCH_ASSOC)) : ?> <tr> <td> <a href="specialprice.php"> <?php echo $customer['CardName'];?> </a> </td> <td><?php echo $customer['CardCode'];?></td> </tr> <?php endwhile; ?> </tbody> </table> Then it Links to this page (specialprice.php) to show the relevant products: SQL: $specialPricing = "SELECT T0.ItemCode, T0.ItemName, CAST(T1.Price AS DECIMAL(9,2)) AS Price FROM oitm T0 JOIN ospp T1 ON T0.ItemCode = T1.ItemCode WHERE T1.CardCode = 'CM000001-M'"; $oitmTable = sqlsrv_query( $sapconn, $specialPricing); PHP: <table> <thead> <tr> <th>SLP Code</th> <th>SLP Name</th> <th>Price</th> </tr> </thead> <tbody> <?php while($users1 = sqlsrv_fetch_array($oitmTable, SQLSRV_FETCH_ASSOC)) : ?> <tr> <td><?php echo $users1['ItemCode'];?></td> <td><?php echo $users1['ItemName'];?></td> <td>£<?php echo $users1['Price'];?></td> </tr> <?php endwhile; ?> </tbody> </table> But i want it where the id of "CM000001-M" is dynamic to which customer has been clicked. Any advice on how to achieve this? Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.