Hello,
I have this code:
<?php
session_start();
if (isset($_GET["cmd"]))
$cmd = $_GET["cmd"];
else
die("You should have a 'cmd' parameter in your URL");
$con = mysql_connect("localhost","xxx","xxx");
if(!$con)
{
die('Connection failed because of' .mysql_error());
}
mysql_select_db("ebay",$con);
if($cmd=="GetAuctionData")
{
echo "<table border='1' width='100%'>
<tr>
<th>Seller ID</th>
<th>Start Date</th>
<th>Description</th>
</tr>";
$sql="SELECT * FROM Auctions WHERE ACCESSSTARTS='8.7.2008 17:18:37'";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
echo "<tr>
<td>".$row['SELLER_ID']."</td>
<td>".$row['ACCESSSTARTS']."</td>
<td>".$row['ARTICLE_NAME']."</td>
</tr>";
}
echo "</table>";
}
mysql_close($con);
?>
Which is called from ajax javascript file, which in turn is called from the main page. I would like to know how to modify this to take a paramater, so instead of hard coding in $sql, it would return he record that was clicked on. If I click on a record in the main page it will pass the primary key to this code and perform the relevant query.
Please do not suggest a framework, as it is not the answer I am looking for, and would like to know how to write what I want regardless.