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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:50:48+00:00 2026-05-27T04:50:48+00:00

$cour = mysql_sql(‘SELECT c.id, c.category, cc.name, c.fullname,c.summary FROM mdl_course c, mdl_course_categories cc WHERE c.id

  • 0
$cour = mysql_sql('SELECT c.id, c.category, cc.name, c.fullname,c.summary FROM 
mdl_course c, mdl_course_categories cc WHERE c.id = cc.course');

echo '<table>';                       
foreach($cour as $cou) 
{
    $coursename = $cou->fullname;
    $courseid = $cou->id;
    $summary = $cou->summary;
    echo '
        <tr style="border:1px solid #BACC82;">  
            <td><a onclick="ShowHide(); return false;">'.$coursename.'</a></td>
        </tr>
        <!--SHOW AND HIDE DIV-->
        <div id="enclosure" style="display:none;">'.$summary.'</div>
    ';
}
echo '</table>';

JQUERY IN THE SAME FILE

function ShowHide() {
    $('#enclosure').animate({"height": "toggle"}, {duration: 1000});
}

Here in my code and its working only for the first row.
I want to pass $courseid to Jquery, so that wherever if i click on coursename, it should display current course summary and if i click the next coursename, the previous summary should hide and show the present one. Could anyone help me a clear code.

  • 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-27T04:50:49+00:00Added an answer on May 27, 2026 at 4:50 am

    You can also do it in the following way:

    $cour = mysql_sql('SELECT c.id, c.category, cc.name, c.fullname,c.summary FROM 
    mdl_course c, mdl_course_categories cc WHERE c.id = cc.course');
    
    echo '<table>';                       
    foreach($cour as $cou) 
    {
        $coursename = $cou->fullname;
        $courseid = $cou->id;
        $summary = $cou->summary;
        echo '
            <tr style="border:1px solid #BACC82;">  
                <td>
                    <a onclick="ShowHide('.$courseid.'); return false;">'.$coursename.'</a>
                    <!--SHOW AND HIDE DIV-->
                    <div id="enclosure_'.$courseid.'" style="display:none;">'.$summary.'</div>
                </td>
            </tr>
        ';
    }
    echo '</table>';
    

    The javascript:

    function ShowHide(id) {
        $('#enclosure_'+ id).animate({"height": "toggle"}, {duration: 1000});
    }
    

    I made every element with a unique ID by give the div a enclose_{ID} because the id from the database is unique, every div aswell.

    EDIT: see update for the HTML

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got to add a new row with it's content populated from an ajax
is there any way i can convert below syntax to LINQ equivalent. select DateName(
In C# our maintainance project, we observered that the previous company has a root
I have an ajax call that returns JSON data (Data Attached). After converting the
I am not sure if I formatted the title well but this is continued
I'm doing some data analysis over the judge appointment system in France, and using
asp.net c# Our webpage currently contains a rather large web app which causes a
I'm trying to convert an NFO file with some crazy high ASCII arts using
I have a class as follows: Public Class Courses Public CoursesOfferedMAIN As New List(Of
For some reason, when I execute this program with the following expression 12 12

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.