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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:19:38+00:00 2026-05-28T06:19:38+00:00

According to the PHP Documentation PDO::prepare() adds quotes to all your parameters so that

  • 0

According to the PHP Documentation PDO::prepare() adds quotes to all your parameters so that you don’t have to worry about doing it:

“The parameters to prepared statements don’t need to be quoted; the driver automatically handles this. If an application exclusively uses prepared statements, the developer can be sure that no SQL injection will occur (however, if other portions of the query are being built up with unescaped input, SQL injection is still possible).”

The problem with this for me is the way I am building my queries and my database structure. Usually the FROM part of an SQL Statement wouldn’t need to be parametrized because the Table probably would be defined by direct user input. However with my code that is the case in some places and thus I feel more comfortable with the parametrized version.

SELECT * FROM ? WHERE ?=?

as opposed to
SELECT * FROM tablename WHERE ?=?

So my question is this, is it possible to prevent my PDO Object from adding the quotes around the FROM parameter so that I don’t get SQL errors thrown in my face? Or do I have to do this in a different manner.

  • 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-28T06:19:39+00:00Added an answer on May 28, 2026 at 6:19 am

    The placeholders in prepared statements are for values only. The only way to insert dynamic table names is to do it yourself

    "SELECT FROM `".$table."` WHERE `".$column."` = ?"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to the PDO documentation , you can store database login details in php.ini,
According to this post , i ask $title. Which are your favorite PHP coding
According to PHP documentation, HttpResponse is a static class to manipulate the Http response
If $_SERVER['HTTP_REFERER'] cannot be trusted according to PHP documentation, how do you be sure
Consider a PHP script that outputs all POST data, as follows: <?php var_dump($_POST); ?>
I may have just ran into one of those wtf PHP? moments. According to
I have a nested simple XML structure that I load with PHP's simpleXML. Some
How would I do that? According to PHP.net, $a = hi; $hi = 2;
my site is all happily Gzipped according to: http://www.gidnetwork.com/tools/gzip-test.php However when I run it
According to the PHP documentation, mysql_insert_id takes the last inserted id from the mysql

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.