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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:06:59+00:00 2026-05-11T14:06:59+00:00

My site is rather extensive, and I just recently made the switch to PHP5

  • 0

My site is rather extensive, and I just recently made the switch to PHP5 (call me a late bloomer).

All of my MySQL query’s before were built as such:

'SELECT * FROM tablename WHERE field1 = 'value' && field2 = 'value2''; 

This made it very easy, simple and friendly.

I am now trying to make the switch to mysqli for obvious security reasons, and I am having a hard time figuring out how to implement the same SELECT * FROM queries when the bind_param requires specific arguments.

Is this statement a thing of the past?

If it is, how do I handle a query with tons of columns involved? Do I really need to type them all out every time?

  • 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. 2026-05-11T14:07:00+00:00Added an answer on May 11, 2026 at 2:07 pm
    "SELECT * FROM tablename WHERE field1 = 'value' && field2 = 'value2'"; 

    becomes

    "SELECT * FROM tablename WHERE field1 = ? && field2 = ?"; 

    which is passed to the $mysqli::prepare:

    $stmt = $mysqli->prepare(   "SELECT * FROM tablename WHERE field1 = ? && field2 = ?"); $stmt->bind_param( "ss", $value, $value2);  // "ss' is a format string, each "s" means string $stmt->execute();   $stmt->bind_result($col1, $col2); // then fetch and close the statement 

    OP comments:

    so if i have 5 parameters, i could potentially have "sssis" or something (depending on the types of inputs?)

    Right, one type specifier per ? parameter in the prepared statement, all of them positional (first specifier applies to first ? which is replaced by first actual parameter (which is the second parameter to bind_param)).

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

Sidebar

Related Questions

Recently, a client asked that his site be percent-based rather than pixel-based. The percent
I have a custom made web-site in Python/MySQL with custom user/session tables and users
I'm working on a rather extensive mobile site using JQM (1.1.0). The structure is
I have a rather complicated deploy setup for our Drupal site that is a
I'm working on a rather full-on site using jQuery (if the solution is not
I have a niche site that I'd like to sell banners for directly, rather
What if a user hits my site with http://www.mysite.com/Quote/Edit rather than http://www.mysite.com/Quote/Edit/1000 In other
site.com/link?p=2 give $_GET['p']==2 even though i've already made site.com/link rewrite to site.com/index.php?page=link So, i'm
Site: http://partsconsign.com/parts/?custid=1 I don't know what happened. All of a sudden, without changing the
I'm building a site on Spree 0.70.3 and Rails 3.1.3. In development I just

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.