Forum Moderators: coopster
I am passing the data via GET to my template.php page successfully. When I get there, I can't format the page correctly. I may have to post this in MySQL forum but thought I would try here first.
Below is what I have on my initial page. It's populating an array from a MySQL query and then printing the following:
print "<td align=left><font size=2 px><a href=\dev\invoice.php?var='$a'>$a</a></font></td>";
print "<td align=left><font size=2 px>$b</font></td>";
print "<td align=left><font size=2 px>$c</font></td>";
etc...
This passes "http://www.domain.com/dev/template.php?var='0000000026' to the next page (template.php).
Once on the template.php page, I am trying to run a SQL Query that says "WHERE invoice='var'" but I don't know what I need to put in for 'var'...
Basically, whatever "0000000026" is, I want that to be passed to where 'var' is in the query so that it can populate the correct data.
Actual code of template.php page:
<?PHP
require './connect.php';
$result = mysql_query('SELECT Sales.Invoice, Sales.InvDate, SalesLed.Prod
FROM SalesLed INNER JOIN Sales ON SalesLed.Invoice = Sales.Invoice
WHERE (((Sales.Invoice)="0000000026") AND ((SalesLed.Prod)="LAB"))');
while ($row = mysql_fetch_array($result)) {
printf ("%s <br>", $row['InvDate']);
}
mysql_free_result($result);
?>
I want to replace "0000000026" with the 'var' element.
I realize it's probably something simple but I have been looking at this code for too long to figure it out.
Thanks for everything!
<?PHP
require './connect.php';
$varsome = $_GET['var'];
$result = mysql_query('SELECT Sales.Invoice, Sales.InvDate, SalesLed.Prod
FROM SalesLed INNER JOIN Sales ON SalesLed.Invoice = Sales.Invoice
WHERE Sales.Invoice="$varsome" AND SalesLed.Prod="LAB"');
while ($row = mysql_fetch_array($result)) {
printf ("%s <br>", $row['InvDate']);
}
mysql_free_result($result);
?>
?>