If you have a filed defined and timestamp in MySQL table and you want to insert or update the field using mysqli binding, you can make use of the now() function of MySQL
Example Insert query:
$query = "INSERT INTO my_table VALUES ('text1',now())";
mysqli_query($mysqli, $query);
Example Update query:
$query = "UPDATE my_table SET $topicId=?, $topicName=?, created_date=now()";
$stmt -> bind_param("ss",$topic_name,$topic_desc);
$stmt -> execute();
$stmt -> close();
More Posts related to PHP,
- How to destroy PHP session()
- PHP Code for sending Emails
- 403 forbidden error for Image
- macOS - cannot calculate MAC address: Using fd 9 hv_vm_create HV_ERROR [PHP XAMPP]
- Upload Pdf file using PHP Script
- PHP header location function not called
- Copy file from one directory to other in Php
- PHP.ini: How to Remove URL Forward Slash Before Single or Double Quotes
- PHP Base64 encoding decoding a variable
- PHP Fatal error : Call to a member function bind_param() on a non-object
- PHP Script to Upload Images to Server
- Upload docx file using PHP script
- How to Pretty Print JSON in PHP
- PHP Warning: Cannot modify header information - headers already sent
- PHP drag and drop file upload tutorial using dropzone.js
- Failed to load resource: net::ERR_CACHE_MISS PHP
- PHP 301 Redirect Permanently
- Call PHP function on Button click using jquery ajax
- Installing vue.js in Laravel 8
- Save current timestamp in MySQL using PHP mysqi binding
- Delete file using PHP code : unlink()
More Posts:
- Bash command to Read, Output and Manipulate JSON File - Bash
- Generate Project Dependency tree using Gradle Command - Gradle
- Bash Hello World! Script Tutorial - Bash
- GitPython: How to check out a Branch - Python
- Bash Command To Check If File Exists - Bash
- How to Vertically Center Align Text in a Div using CSS Code Example - CSS
- How to Split a String using delimiter in Python - Python
- Check macOS free disk space using Terminal command - MacOS