php date/time help
<?php
$now = time();
$query = "INSERT INTO `table` (`time`) VALUES ('$now')";
mysql_query($query);
sleep(2);
$later = time();
$query = "SELECT * FROM `table`";
$res = mysql_query($query);
$data = mysql_fetch_array($res);
if( $data['time'] < $later )
{
do_whatever();
}
else
{
do_something_different();
}
?>
PM me if you have any questions
thanks il check it out now :)
edit how do i pass the "name" variable into the url for get_info.php to work?
<form id="search_form" name="search_form" method="post" action="<?php echo $GLOBALS['file_path'];?>get_info.php?">
<div align="right">
<span class="Forms">Name</span>
<input name="name" type="text" id="name" />
<input name="search_btn" type="submit" class="Default" id="btn_search" value="search" />
</div>
</form>```
get_info.php
```markup
<?php
$req_name = trim($_GET['name']);
$req_name = urldecode($req_name);
@xJorxDyx (Sorry if I did yer nick wrong), for your form action, set it as method="get" not "post"
thanks that worked :)
The code did not work right :angry: when i submitted the query to update the datetime field in the database it did not work. It only works when the field is a "time" field. How to i insert into a "datatime" field?
xJorDyx wrote: thanks that worked :)
The code did not work right :angry: when i submitted the query to update the datetime field in the database it did not work. It only works when the field is a "time" field. How to i insert into a "datatime" field?
I only used those MySQL table and column names as an example, just change them to match what you have. You might want to make a new table to play with this stuff, in case you accidently break something ;)