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 7541379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:52:36+00:00 2026-05-30T07:52:36+00:00

I wonder whether someone may be able to help me please. From some demos

  • 0

I wonder whether someone may be able to help me please.

From some demos and tutorials I’ve found, I’ve put together this page which adds toggle panes to a page using values from a mySQL database to populate the fields.

The problem I’m having is that at each layer only the first out of multiple records is shown.

e.g. The screen currently shows 16/03/2012 as the only record, there should be one other record for the 23/02/2012.

Then within the 16/03/2012, the next level should show two items, whereas it is only showing one.

I’ve been working on this for a while now but I can’t seem to find the solution of how to show the correct number of records.

I just wondered whether someone could perhaps have a look at this please and let me know where I’m going wrong.

I’ve added the full script below for reference.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>Panel Test</title> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 
<script type="text/javascript"> 
jQuery(document).ready(function() {
  jQuery(".content").hide();
  //toggle the componenet with class msg_body
  jQuery(".heading").click(function()
  {
    jQuery(this).next(".content").slideToggle(500);
  });
});
</script>
<style type="text/css"> 
body {
    margin: 20px auto;
    font: 12px Verdana,Arial, Helvetica, sans-serif;
}
.layer1 {
margin: 0;
padding: 0;
width: 500px;
}

.heading {
margin: 1px;
color: #fff;
padding: 3px 10px;
cursor: pointer;
position: relative;
background-color:#c30;
}
.content {
padding: 5px 10px;
background-color:#fafafa;
}
p { padding: 5px 0; }
</style> 
</head> 
<?php
mysql_connect("hostname", "username", "password")or
die(mysql_error());
mysql_select_db("database");

$result = mysql_query("SELECT userdetails.userid, finds.dateoftrip, detectinglocations.locationname, finds.userid, finds.locationid, detectinglocations.locationid,   finds.findname, finds.finddescription FROM userdetails, finds, detectinglocations WHERE finds.userid=userdetails.userid AND finds.locationid=detectinglocations.locationid AND finds.userid = 1 ORDER BY dateoftrip DESC");

if (mysql_num_rows($result) == 0) 
// table is empty 
  echo 'There are currently no finds recorded for this location.'; 
  else
 { 
    while ($row = mysql_fetch_array($result)) 
    { 
    $dateoftrip = $row['dateoftrip']; 
    $findname = $row['findname'];   
{ 
}
}
}
?>
<body>
<div class="layer1"> 
        <p class="heading"><input name="dateoftrip" id="dateoftrip" type="text" value="<?php echo $dateoftrip;?>" disabled="disabled"/></p> 
        <div class="content"> 
            <input name="findname" id="findname" type="text" value="<?php echo $findname;?>" disabled="disabled"/>
        </div> 
</div> 
</body> 
</html> 

Many thanks and kind regards

  • 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-05-30T07:52:37+00:00Added an answer on May 30, 2026 at 7:52 am

    You are fetching all the records but using only the last one.
    You should put this:

    <div class="layer1"> 
            <p class="heading"><input name="dateoftrip" id="dateoftrip" type="text" value="<?php echo $dateoftrip;?>" disabled="disabled"/></p> 
            <div class="content"> 
                <input name="findname" id="findname" type="text" value="<?php echo $findname;?>" disabled="disabled"/>
            </div> 
    </div> 
    

    in the while loop which fetch the data:

        while ($row = mysql_fetch_array($result)) 
        { 
         $dateoftrip = $row['dateoftrip']; 
        $findname = $row['findname'];
    

    So it will look like this:

            while ($row = mysql_fetch_array($result)) 
            { 
             $dateoftrip = $row['dateoftrip']; 
            $findname = $row['findname'];
    echo '<div class="layer1"> 
                <p class="heading"><input name="dateoftrip" id="dateoftrip" type="text" value="'.$dateoftrip.'" disabled="disabled"/></p> 
                <div class="content"> 
                    <input name="findname" id="findname" type="text" value="'.$findname.'" disabled="disabled"/>
                </div> 
        </div>';
           }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder whether someone may be able to help me please. I've put together
I wonder whether someone may be able to help me please. I've put some
I wonder whether someone may be able to help me please. I've put together
I wonder whether someone may be able to help me please. I've put together
I wonder whether someone may be able to help me please. I've put together
I wonder whether someone may be able to help me please. I've put together
I wonder whether someone may be able to help me please. Using some excellent
I wonder whether someone can help me please. I've put together this page, which
I wonder whether someone may be able to help please. I'm trying to put
I wonder whether someone could help me please, From a tutorial I found online

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.