OK, I have been searching both here and on the Web for a couple of days now and can't seem to find what I am looking for.
What I am trying to do is extract a specific record from the database based on the value of 2 records. I guess this could be called a Search of sorts, only the search is strictly defined based on the URL in the link to this page.
This is the URL I am trying to pass and get to extract the data. This creates the
data3-det.php?recordID=6&billinglengthID=2
Which are the correct values based on the master Database extraction.
<a href="data3-det.php?recordID=<?php echo $row_plan_all['product_id']; ?>&billinglengthID=<?php echo $row_plan_all['billing_id']; ?>"> <?php echo $row_plan_all['plan_name']; ?> </a>
Here is the Code for data3-det.php
$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) {
$colname_DetailRS1 = $_GET['recordID'];
}
$billname_DetailRS1 = "-1";
if (isset($_GET['billinglengthID'])) {
$billname_DetailRS1 = $_GET['billinglengthID'];
}
mysql_select_db($database_Test_Alp, $Test_Alp);
$query_DetailRS1 = sprintf("SELECT * FROM billings_products, products WHERE product_id = %s, billing_id = %s", GetSQLValueString($colname_DetailRS1, "int"),GetSQLValueString($billname_DetailRS1, "int"));
$DetailRS1 = mysql_query($query_DetailRS1, $Test_Alp) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($DetailRS1);
The Problem is the data3-det.php does not work and returns the following error.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' billing_id =' at line 1
Everything works correctly if I only select from a single parameter such as just 'recordID'. However, I can't get this to work when selecting from multiple records or if trying to use the second parameter only 'billinglengthid'. Therefore, I believe something is wrong with the second parameter, but I don't know what..
Thanks,
Cliff