Hello,
I have the following code, which works fine:
echo '<div id="Result">Content goes here</div>';
echo "<h1>Table: {$table}</h1>";
echo "<table border='1'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo '<td><a href="#" onclick="GetAuctionData()">' . $cell . '</a></td>';
echo "</tr>\n";
}
Result gets filled with the result of the ajax query, which calls this.
echo "<table border='1' width='100%'>
<tr>
<th>test1</th>
<th>test2</th>
<th>test3</th>
</tr>";
$sql="select * from auctions where ARTICLE_NO='110294394238';
$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>";
My questions are these:
How can I make the query in the second block of code, match the row being clicked on from the first block of code. i.e. not have article_no hardcoded in, but replaced with the article_no of what I click on. Would a variable have to be shared between both files somehow?
Is it difficult to change the table layout to layers, or it would not matter?
One of the fields contains a link to an image, is there a way to embed that somehow? Something like <img src=".$row['PICTURE'].">
?
edit:
function GetAuctionData()
{
xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{
alert("Your browser is not supported?")
}
var url="get_auction.php?"
url=url+"cmd=GetAuctionData"
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange = FetchComplete;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}