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

  • SEARCH
  • Home
  • 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 8545595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:49:35+00:00 2026-06-11T12:49:35+00:00

i have a php loop that i use to fetch multiple auction records from

  • 0

i have a php loop that i use to fetch multiple auction records from a database. as a part of the auction i want to have a countdown until it ends. i originally had a problem that only the first record was displaying the countdown timer (working) and determined it was probably because i was giving the jquery selector the same id every time. so i changed it so a new id is generated to give to the div and jquery function on each loop. but now when i look at the result of my script the countdown timer doesnt display in any table row.

   while($row = $stmt->fetch(PDO::FETCH_ASSOC)){        
       $ID = $row['ID'];
            $cdRand = '#row'.$ID;
                $img = $row['img'];
                $desc = $row['description'];
                $name = $row['name'];
                $owner = $row['owner'];
                $cprice = $row['sprice'];
                $iprice = $row['iprice'];
                $incprice = $row['incprice'];
                $etime = $row['etime'];
                $nextBid = $cprice + $incprice;

            $stmt2 = $pdo->prepare("SELECT * FROM user WHERE username = :username");
            $stmt2->bindParam(":username", $owner,PDO::PARAM_STR);
            $stmt2->execute();

            $thisuser2 = $stmt2->fetch(PDO::FETCH_ASSOC);
            $location = $thisuser2['location'];

            echo'

            <tr class="resultindex">

            <td class="imgCol"><a href="displayAuct.php?id='.$ID.'"><img src="'.$img.'" alt="'.$name.'" /></a></td>
            <td class="infoCol">

                <div class="nameDiv">
                    <a class="nameLink" href="displayAuct.php?id='.$ID.'">'.$name.'</a><br/>
                </div>
                <div class="descDiv">
                    <span class="priceLabel2">'.$desc.'</span>
                </div>

                <div class="userdiv">
                    <span class="fromuser">Location: </span><br/>
                    <span class="location">'.$location.'</span>
                </div>
            </td>
            <td style="width:1px; background-color:#330066;" ></td>

            <td class="timerCol">
                <div class="currentp" style="height: 50px;"><span class="priceLabel">Current Bid: </span><br/><span class="price1">$'.$cprice.'</span></div>
                <div id="timeRow" style="height: 30px;">
                    <span class="timeleft">Time Left: </span>
                </div>
                <div id="'.$cdRand.'" style="height:80px;"></div>

                <script type=text/javascript>
                var timestamp = '. $etime * 1000 .';
                var endTime = new Date();
                endTime.setTime(timestamp);



                $("'.$cdRand.'").countdown({until: endTime});

                </script>
            </td>
            </tr>

                ';

i cant quite tell why it doesn’t work, the countdown timer is keith woods countdown plugin http://keith-wood.name/countdown.html, any help would be greatly appreciated.

cheers,
bundy

  • 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. Editorial Team
    Editorial Team
    2026-06-11T12:49:36+00:00Added an answer on June 11, 2026 at 12:49 pm

    This is an ID selector:

    #row11
    

    This is a <div> with a valid id attribute:

    <div id="row11">
    

    but this isn’t a valid id attribute:

    <div id="#row11">
    

    Your $cdRand shouldn’t contain the # and your jQuery should include the # like this:

    $("#'.$cdRand.'").countdown({until: endTime});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In PHP I can use a foreach loop such that I have access to
I have a php script that loads data from a database. The table I
I have a large PHP loop that I'm re-using in multiple spots on multiple
I have a php loop that is echoing out geolocation values. How can I
I have the following php loop that takes an array that contains a set
I use a form where i have listed the data from database like title,
OK so I have a php include that houses some queries and want to
I have a PHP while loop that generates a table containing input tags. Each
I have a php file that reads in information from a txt file and
i have a php loop which displays only one record even if there is

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.