title: How to add current time stamp into image path
body: <p>I'm trying to add current time stamp into image path in php and store the image path into MySQL. I've searched from google and saw <code>insert_time=now()</code>. I trying to code but I get error in my php.</p>
  
  <pre><code>&lt;?php
      if( $_SERVER['REQUEST_METHOD']=='POST' ){
  
          if( !empty( $_POST['listItems'] ) ){
  
              $mysqli = new mysqli("127.0.0.1:3307", "root", "", "androiddb");
              if( $mysqli-&gt;connect_errno ) echo "Failed to connect to MySQL";
  
              $image = $_POST['image'];
  
              $listItems = json_decode( $_POST['listItems'], true ); 
  
              $sql="SELECT id FROM staff_benefit ORDER BY id ASC";
  
              $id=1;
  
              $res=$mysqli-&gt;query( $sql );
              while( $rs=$res-&gt;fetch_object() ) $id=$rs-&gt;id;
  
              $path=NOW()."$id.png";
              $actualpath="http://192.168.107.115:80/Android/CRUD/PhotoUpload/$path";
  
              $sql="INSERT INTO `staff_benefit` ( `type`, `amount`, `description`, `image`, `ts_id` ) VALUES ( ?, ?, ?, ?, ? )";
              $stmt=$mysqli-&gt;prepare( $sql );
  
              $pathelements=array( realpath( $_SERVER['DOCUMENT_ROOT'] ), 'CRUD', 'PhotoUpload', '' );
              $savepath = realpath( implode( DIRECTORY_SEPARATOR, $pathelements ) ) . "{$id}.png";
  
              $bytes=file_put_contents( $savepath, base64_decode( $image ) );
              if( !$bytes ){
                  echo 'Error saving image';  
              }
  
              if ( $stmt &amp;&amp; $bytes) {
                   foreach( $listItems as $item ){ 
  
                      $stmt-&gt;bind_param('sssss', $item['type'], $item['amount'], $item['description'], $actualpath, $item['ts_id'] );
                      $res=$stmt-&gt;execute();
  
                      if( !$res ) echo 'Query failed with code: '.$stmt-&gt;errno;
                  } 
              }
              $mysqli-&gt;close();
          }
      }
  ?&gt;
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>call to undefined function Now()
  </code></pre>
  
  <p>It seems like the Now() is not existing :( .</p>