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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:56:02+00:00 2026-06-05T19:56:02+00:00

When using $optionquery = SELECT OptionId FROM Option_Table WHERE (OptionType = ?); // Bind

  • 0

When using

$optionquery = "SELECT OptionId FROM Option_Table WHERE (OptionType = ?)";

// Bind parameter for statement
$optionstmt->bind_param("s", $selected_option);

This is fine, but if I want to use the WHERE clause to look for the variable within a folder, how is it suppose to be written? Is it like this below?

$optionquery = "SELECT OptionId FROM Option_Table WHERE (OptionType = 'VideoFiles/?')";

// Bind parameter for statement
$optionstmt->bind_param("s", $selected_option);

or like this:

$optionquery = "SELECT OptionId FROM Option_Table WHERE (OptionType = ?)";

// Bind parameter for statement
$optionstmt->bind_param("s", 'VideoFiles/$selected_option');

Does the single quote go around both the foldername and the variable name or does it just go around the folder name?

  • 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-05T19:56:03+00:00Added an answer on June 5, 2026 at 7:56 pm

    You need to use the latter

    $optionquery = "SELECT OptionId FROM Option_Table WHERE (OptionType = ?)";
    

    There are a number of ways to quote the string, either of the following are fine:

    $optionstmt->bind_param("s", 'VideoFiles/' . $selected_option);
    // or
    $optionstmt->bind_param("s", "VideoFiles/$selected_option");
    

    Putting a variable in single quotes ' however will not work. The variable will not be translated to its actual value, you will get the literal string $selected_option in the query if you use single quotes.

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

Sidebar

Related Questions

Using the following query: SELECT sum(severity) as Score, DATE_FORMAT(LAST_UPDATE,%Y-%m) as score_date FROM missingpatches GROUP
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
Using Flex 3, I would like to take an image snapshot such as this:
Using mercurial, I've run into an odd problem where a line from one committer
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
(Using MVC 2) From inside my controller action, I need to display the url:
Using Java,I have to fetch multiple sets of values from an XML file to
Using Yii, I want to delete all the rows that are not from today.
using file_get_contents , I open an Internet URL and get the contents of this
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter

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.