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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:00:14+00:00 2026-05-25T16:00:14+00:00

in the mysqli php library, in the bind_param() method one binds the parameters to

  • 0

in the mysqli php library, in the bind_param() method one binds the parameters to the query. bind_param()‘s first argument is types, a string where each character represents the datatype pass, eg, ‘s’ for string.

$query = "update users set update_usr_id = ? where user_id = ?";
$arg1 = ($update_usr_id=$usr_id) ? '2011-01-01' : 'CURRENT_DATE';
$arg2 = $update_usr_id;

how can one represent NULL or CURRENT_DATE as a parameter?

for example, tried ‘CURRENT_DATE’ as string, but that posted as “0000-00-00”. (as far as I can tell “0000-00-00”, an illegal date, is a mysqlism for NULL for people who don’t use NULL, which apparently is quite a few).

using parameters, how can one use NULL and CURRENT_DATE?


@Johan pointed out that NULL does work. on testing, this appears to be true, but is not. what happens is that, starting with the first NULL parameter, all parameters are set to NULL!

default values have nothing to do with this. There are many times I would wish to set a column to NULL or CURRENT_DATE in an UPDATE – not an INSERT – so default values play no part in the transaction.

also, the idea of writing a trigger to cover the inadequacy of mysqli is pretty bad programming – having written spaghetti triggers in my day, I am one to talk. triggers to update logs are one thing – triggers like this will be a constant maintenance nightmare with little odds the code will ever be maintained correctly.

  • 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-25T16:00:14+00:00Added an answer on May 25, 2026 at 4:00 pm

    mysqli parameters are limited and difficult to use. Not only do they not accept NULL and internal functions like CURRENT_DATE as parameters, each parameter to be passed by reference. (This means a parameter needs to be created for each parameter – which might be necessary for INOUT procedure arguments or SELECT INTO, but for normal dml is simply a waste of time.) On top of that, they are evidently not stored by the session or db to make subsequent calls more efficient.

    (Compare to Postgres prepared statement, for example, which is named and my be re-used (howbeit only at the session level). This means the db does not need to be re-taught the statement; it also means the statement is already “planned”, so not only the semantics but the execution plan is learned and re-used to increase speed.)

    Currently writing something for MySQL that is, I hope, actually usable. Will post later.

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

Sidebar

Related Questions

http://php.net/manual/en/mysqli.init.php $ConnectionResource = mysqli::init(); The above code fails with: Fatal error: Non-static method mysqli::init()
The MySQLi feature of PHP is great. Prepared Statements are great for injecting parameters
Server details: PHP v5.3.5 Using MySQLi library client api version: mysqlnd 5.0.7-dev - 091210
http://php.net/manual/en/function.mysql-real-escape-string.php : mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following
I have my own php data object class that wraps the mysqli library. It
I'm using MySQLi with PHP(5.2.4) MySQL(5.0.51a) on Ubuntu 8.04 LAMP. The relevant Db tables
Possible Duplicate: PDO Prepared Statements I'm using the mysqli extension in PHP and I'm
I was writing a database handler class in PHP using the mysqli class and
MySQL connection in PHP can be established in two ways: $mysql = new mysqli('localhost',
I'm using prepared statements and MySQLi, and am currently getting this error. PHP Catchable

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.