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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:23:58+00:00 2026-05-31T08:23:58+00:00

I am using jquery ui’s tabs And i want to make it dynamic by

  • 0

I am using jquery ui’s tabs

And i want to make it dynamic by getting the tabs from a mysql database using php , but not sure how to add the fragment 1 , 2 , 3 according to the number of rows of the table i have.
For example , there’s 5 rows , that means there’s 5 fragment. here’s the html code for the jquery ui.

<div id="featured" >
    <ul class="ui-tabs-nav">
        <li class="ui-tabs-nav-item ui-tabs-selected" id="nav-fragment-1"><a href="#fragment-1"><img class="thumb" src="http://upload.wikimedia.org/wikipedia/en/thumb/0/0f/Avs38.jpg/250px-Avs38.jpg" alt="" /><span>15+ Excellent High Speed Photographs</span></a></li>
            <li class="ui-tabs-nav-item" id="nav-fragment-2"><a href="#fragment-2"><img class="thumb" src="http://www.crunchbase.com/assets/images/original/0007/5132/75132v1.jpg" alt="" /><span>20 Beautiful Long Exposure Photographs</span></a></li>  
    </ul>
    <!-- First Content -->
    <div id="fragment-1" class="ui-tabs-panel" style="">
        <img src="image.jpg" alt="" />
        <div class="info" >
        <h2><a href="#" >Loerm Ipsum</a></h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla tincidunt condimentum lacus. Pellentesque ut diam....<a href="#" >read more</a></p>
        </div>
    </div>

</div>

Normally i would use this php code to echo out database

  <?php
           $rows = array();
    while($row = mysql_fetch_array( $query )){

      $rows[] = $row;

      echo "'Some html code data $row[image] test'\n";
      }

    }

    ?>

However if i use this code , it will generate a html like :

<div id="fragment-1" class="ui-tabs-panel" style="">
            <img src="image.jpg" alt="" />
            <div class="info" >
            <h2><a href="#" >Loerm Ipsum</a></h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla tincidunt condimentum lacus. Pellentesque ut diam....<a href="#" >read more</a></p>
            </div>
        </div>
<div id="fragment-1" class="ui-tabs-panel" style="">
            <img src="image2.jpg" alt="" />
            <div class="info" >
            <h2><a href="#" >Loerm Ipsum2</a></h2>
            <p>L2222<a href="#" >read more</a></p>
            </div>
</div>

As you can see , it does not make the second fragment , fragment TWO.

I want the results to be like this:

<div id="fragment-1" class="ui-tabs-panel" style="">
            <img src="image.jpg" alt="" />
            <div class="info" >
            <h2><a href="#" >Loerm Ipsum</a></h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla tincidunt condimentum lacus. Pellentesque ut diam....<a href="#" >read more</a></p>
            </div>
        </div>
<div id="fragment-2" class="ui-tabs-panel" style="">
            <img src="image2.jpg" alt="" />
            <div class="info" >
            <h2><a href="#" >Loerm Ipsum2</a></h2>
            <p>L2222<a href="#" >read more</a></p>
            </div>
</div>

So how can i do this?

  • 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-31T08:24:00+00:00Added an answer on May 31, 2026 at 8:24 am

    If you are talking about initial loading of the tabs, then modify your code to have a counter, and output the value of that counter to the tab fragment as follows:

    <?php
        $count = 0; // Initialize counter
        $rows = array();
        while($row = mysql_fetch_array( $query )) {
            $rows[] = $row;
            echo '<div id="fragment-' . ++$count . '" class="ui-tabs-panel" style="">';
            echo "'Some html code data $row[image] test'\n";
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Jquery AJAX to get a value from a PHP script. This line works
Using jquery, I want to post data to from one of my pages to
Using jQuery to make an AJAX call to a PHP file results in the
Using jQuery, I make these changes in the DOM: $(document).ready(function() { $('.editable').click(function() { var
Using jquery, How can I create multiple draggables using loops through javascript? I want
Using jquery I have a clicking tab mechanism that are nothing but anchor tags
using jquery ui tabs , when you load a tab in ajax, the tab
Using jQuery (1.7), and not jQueryUI - (how) would it be possible to accomplish
Using jQuery, I want to check if the text of a link I'm clicking
Using Jquery Ajax i have an entry script index.php This script lets the user

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.