Hi All,

I'm working on a database wherein I want to input the current date into existing table upon
the user enter his pin. I'm having a hard time to make it work here is my code.

    $result="SELECT * FROM profiletable WHERE (firstName='$_POST[assetSearch]' || lastName='$_POST[assetSearch]' || IDNumber='$_POST[assetSearch]')";
    $q = mysql_query($result,$con);
		if($row = mysql_fetch_array($q))
				 $sql="INSERT INTO profiletable(IDNumber(date))
				 echo "you are login";

any help about this?thank you

6 Years
Discussion Span
Last Post by veedeoo


You can use the unix time if you want. Normally, more people are using this because the chance of duplicates is somewhat pretty rare. Think about having two people clicking the same button at the same time .

You can use like this

$time_posted = $time();

You can then use the $time_posted to be saved in your database.. Usually, you would get something like this 12674916644 bunch of numbers.

If you want to show it on the webpage as readable date and time, all you have to do is to convert back to its original form, before it became unix. Like this

echo date('l jS \of F Y h:i:s A', $time_posted);

You can also calculate the time since it was posted by using the current time as reference like this

## time elapsed since it was posted
$time_elapsed = (time() - ($time_posted));

echo $time_elapsed;

Edited by veedeoo: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.