How Insert now() function in MySQL using PHP -


this question has answer here:

i'm trying update in mysql php codeigniter, but, how can insert now() method? mean, i'm using array insert information, but, how can insert date? example of array:

$data = array(    'name'     => $inputname,    'lastname' => $inputlast,    'dobirth'  => now() ); 

now() part of mysql, not php, need put query.

try way, how handle using pdo. should work:

$stmt = $pdodb->prepare('insert tablename (name, lastname, dobirth) values (:name, :lastname, now())'); // either bind each parameter explicitly  $stmt->bindparam(':name', $name);  $stmt->bindparam(':lastname', $lastname); $stmt->execute(); 

source: datetime php mysql (+ pdo variant)


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -