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();
Comments
Post a Comment