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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:26:08+00:00 2026-05-25T18:26:08+00:00

I have just started creating my first website, which is backed by a database

  • 0

I have just started creating my first website, which is backed by a database (this is also my first db). Due to my total inexperience, I have no idea if I should rely on jQuery or PHP for a specific task, and am hoping that someone might be able to provide some insight. (This is a ‘best practices’ question.)

In the table “Files,” there are 6 fields and approximately 50 rows. Users are shown all of the information in the table, and are able to apply filters (via checkboxes) to manipulate how that data is displayed. For example, if the boxes category = DNA and keyword = assay are checked, a php script selects those rows in the db where the fields category and keyword have the values DNA and assay, respectively. This information is then returned to a jQuery script as a JSON object for formatting and insertion into the DOM (I used $.getJSON).

So far, this works just fine. However, upon reading that “too many” queries to a db incurs a performance penalty, I wrote a new jQuery script which gets ALL of the information from the table “Files” immediately after the document loads. This information is distributed into 6 different arrays (i.e. category[ ] and keyword[ ], with the index of a given row the same in all 6 arrays). Then, if the same filters as above are applied, I search the category[ ] and keyword[ ] arrays. The information associated with the index i is displayed if the strings DNA and assay are found in category[ i ] and keyword[ i ].

Obviously, the second method reduces the number of queries to the db. However, it feels ‘wrong’ to me in that I am using jQuery for something that isn’t exactly ‘behavior,’ and I doubt that jQuery is as fast at searching arrays as MySQL is at finding rows in a table. Testing both versions of the site, they seem to perform equally well, but I am only able to test the site locally. I imagine that the jQuery version will become less viable if the table grows to be very large, but it is unlikely that it will ever exceed 100 rows.

If you have any advice, I would greatly appreciate any help in deciding which option I should implement. Thank you in advance for your input, and I hope you’ll accept my apologies for being such a noob!

  • 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-25T18:26:08+00:00Added an answer on May 25, 2026 at 6:26 pm

    You have to weigh up the calls back and forth to your server in the AJAX version against the client-side manipulation. Although there’s nothing wrong with your inside-out hash approach (the multiple arrays with shared keys), it’s quite possible you could filter the rows based on classes and use jQuery to show/hide them.

    <li class="dna assay">blah...</li>
    

    and elsewhere…

    $('#dnacheckbox').click(function(){ $('.dna').toggle() });
    

    Personally, I don’t see what you’re doing with jQuery as not being behaviour – sorting and filtering is classic user interaction.

    If you can say with confidence that the row-count will remain under a few hundred, I would suggest the client-side option is the one to go for. It will definitely feel snappier to the end-user.

    I’m not sure exactly how you’re presenting your data, but have a look at DataTables before you do too much Wheel R&D.

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

Sidebar

Related Questions

Oracle Newbie Here: I just started out creating my first Oracle database table. I
I have just started building my first Flask app, which currently simply returns output
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I've just started creating Unit Tests for my code again. I have had PHPUnit
I just started creating my first WP theme after doing the HTML/CSS. All good
I have started creating an app which uses a core data stack at the
Have just started using Google Chrome , and noticed in parts of our site,
Have just started playing with ASP.NET MVC and have stumbled over the following situation.
I have just started using silverlight 2 beta and cannot find how to or
I have just started using Boost 1.36. These libraries would be very useful in

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.