<?php
session_start();
if (isset($_GET["cmd"]))
$cmd = $_GET["cmd"];
else
die("You should have a 'cmd' parameter in your URL");
$query = $_GET["query"];
$con = mysql_connect("localhost","root","geheim");
if(!$con)
{
die('Connection failed because of' .mysql_error());
}
mysql_select_db("ebay",$con);
if($cmd=="GetRecordSet")
{
$table = 'Auctions';
$result = mysql_query("SELECT ARTICLE_NO, USERNAME, ACCESSSTARTS, ARTICLE_NAME FROM {$table}");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<h1>Table: {$table}</h1>" . "\n";
echo "<table border='1' width='100%'><tr>" . "\n";
echo "<td width='33%'>Seller ID</td>" . "\n";
echo "<td width='33%'>Start Date</td>" . "\n";
echo "<td width='33%'>Description</td>" . "\n";
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_assoc($result))
{
$pk = $row['ARTICLE_NO'];
echo '<tr>' . "\n";
echo '<td><a href="#" onclick="GetAuctionData(\''.$pk.'\')">' . $row['USERNAME'] . '</a></td>' . "\n";
echo '<td><a href="#" onclick="GetAuctionData(\''.$pk.'\')">' . $row['ACCESSSTARTS'] . '</a></td>' . "\n";
echo '<td><a href="#" onclick="GetAuctionData(\''.$pk.'\')">' . $row['ARTICLE_NAME'] . '</a></td>' . "\n";
echo '</tr>' . "\n";
}
}
mysql_free_result($result);
mysql_close($con);
?>