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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:30:43+00:00 2026-06-06T19:30:43+00:00

I’m currently creating a form validation script based on the jQuery validator plugin .

  • 0

I’m currently creating a form validation script based on the jQuery validator plugin. So, simple configuration’s went easy, like min length, max length, required, etc.
After that, I decided to check for availability on the username/email from client-side,so I had to use the remote option, which is an option I have to specify when creating the rules array. So, when creating the rules, I had to send data to a php script and check the availability of the input field.

But since i’m going to check for availability for multiple input fields, I created a function(in the client-side) to re-use it for every field, and that function requires the input field’s ID and the MySQL table’s name, to make things clear, here’s the function:

Notes:
1.check_input is a php script that will take the input field’s value and the table to check against and it’ll return a json encoded Boolean value, true if there’s no match in the table, otherwise false.

function check_input(input, table){

        $.ajax({
            type:"POST",
            url:site_url+"site/check_input",
            data:{
                input:input,
                table:table,
            }
            
            
        }).done(function(resp){
            var is_unique = JSON.parse(resp);
            return is_unique;
        });
    }

and this function will be called by setting the remote option to
check_input($('#field').val(), 'table.column');.

So, as you see, I must specify my MySQL tables from the client-side, and every user(good&bad ones) can see this, is that considered unsafe or bad practice?
If no, what is the suitable method to check for availability ?

  • 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-06T19:30:45+00:00Added an answer on June 6, 2026 at 7:30 pm

    It’s bad design practice as you should decouple your database schema from your client view code (what if you want to change the database schema).

    It’s bad security practice because it looks like you are using a string to build a SQL query. If you don’t know about SQL injection attacks, learn about them. This is a classic case.

    Put in the extra work and create a proper PHP API that doesn’t require exposing table names.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words

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.