I have this code
while($row = mysql_fetch_row($result)) { echo '<tr>'; $pk = $row[0]['ARTICLE_NO']; foreach($row as $key => $value) { echo '<td><a href='#' onclick='GetAuctionData(\''.$pk.'\')'>' . $value . '</a></td>'; }
which gets pk. pk is then passed on to the axjax part with this:
function GetAuctionData(pk) { ..... var url='get_auction.php?' url=url+'cmd=GetAuctionData&pk='+pk;
And finally used in a separate php file with:
$pk = $_GET['pk']; $sql='SELECT * FROM Auctions WHERE ARTICLE_NO ='$pk'';
the second php file works fine when using it by itself and passing parameters. Likewise there are no errors anywhere. The problem seems to be with passing or generating $pk, as the links in the output file result in $pk being incremednted by 2, eg 4, 6, 8 etc
I can not understand why this is happening.
mysql_fetch_row link does not have subarrays. It will return the first field as 0, next as 1, etc.
Try with
This can easily be used with your foreach
or this gives you both associative and numbered array.
EDIT: Based on
You have to include the row you want a value from. 😉
BTW: Im pretty sure this nested loop will not produce what you want. You’ll get 3 links to each article_no. The first with seller_id as text, the second text is accessstarts, and the last link with the same href will have the text article_name.
Maybe something like this?