Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 78161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:56:37+00:00 2026-05-10T20:56:37+00:00

I have this code while($row = mysql_fetch_row($result)) { echo ‘<tr>’; $pk = $row[0][‘ARTICLE_NO’]; foreach($row

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:56:38+00:00Added an answer on May 10, 2026 at 8:56 pm

    mysql_fetch_row link does not have subarrays. It will return the first field as 0, next as 1, etc.

    Try with

    $pk = $row[0]; 

    This can easily be used with your foreach

    while($row = mysql_fetch_assoc($result)) $pk = $row['ARTICLE_NO']; 

    or this gives you both associative and numbered array.

    while($row = mysql_fetch_array($result, MYSQL_BOTH)) $pk = $row['ARTICLE_NO']; 

    EDIT: Based on

    $result = mysql_query('SELECT SELLER_ID, ACCESSSTARTS, ARTICLE_NAME FROM {$table}'); 

    You have to include the row you want a value from. 😉

    $result = mysql_query('ARTICLE_NO, SELECT SELLER_ID, ACCESSSTARTS, ARTICLE_NAME FROM {$table}'); 

    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?

    while($row = mysql_fetch_assoc($result)) {     $pk = $row['ARTICLE_NO'];     echo '<td><a href='#' onclick='GetAuctionData(\''.$pk.'\')'>' . $row['ARTICLE_NAME'] . '</a></td>'; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 252k
  • Answers 252k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This works fine for me if I simply change all… May 13, 2026 at 9:46 am
  • Editorial Team
    Editorial Team added an answer Am I understanding correctly that only one of the parameters… May 13, 2026 at 9:46 am
  • Editorial Team
    Editorial Team added an answer Do something like this: <input type="checkbox" name="checkboxArray[]" /> Note the… May 13, 2026 at 9:46 am

Related Questions

I have this code while($row = mysql_fetch_row($result)) { echo '<tr>'; $pk = $row[0]['ARTICLE_NO']; foreach($row
I have this code that prints out columns in my DB and adds a
My code looks like this: $result = mysql_query(SELECT * FROM `picdb` WHERE `picid` =
include(conn.php); $result = mysql_query(SELECT * FROM sggame); while($row = mysql_fetch_assoc($result)); { $id = $row['id'];
I am working in PHP/MySQL. I have a table in my database called hourly

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.