Re: timestamp
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Thu, 15 May 2008 07:48:51 -0400
up2trouble wrote:
On May 14, 9:54 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:up2trouble wrote:I changed it to bigint didn't see long one. Now it stores a 0. ItPlease learn how to reply properly. You were not responding to
is not taking my value from mktime(). I read your suggested material.
I understood none of it.
yourself. Also, please quote the relevant parts (as in here).
As to your problem - you didn't give us enough information to go on -
like the real code you're using. Additionally, you need to determine
how you want the data stored - a unix timestamp works, but there are
valid reasons for using a datetime field, also (which is off topic in a
PHP newsgroup, and should be discussed in comp.databases.mysql).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@xxxxxxxxxxxxx
==================
I want a timestamp to store seconds and not a date/time format. The
only thing I took out of the code was the url for my page.
<?PHP
if(isset($_POST['printcodes']))
{
$gettime = date("Y-m-d H:i:s", mktime());
$sql= "SELECT * FROM $db_table10 WHERE created < $gettime";
$result = mysql_query ($sql, $connect) OR DIE ('Query 2 failed cause:
' . mysql_error());
$num = mysql_num_rows($result);
echo "<FIELDSET><FONT SIZE='+1' COLOR='#FF0000'>These are your codes.
Just save to your desktop, then
open in Word to print.</FONT></FIELDSET> ";
while ($row = mysql_fetch_array ($result))
{
echo "<P STYLE='text-align: justify; width: 550px;'>This is the
anonymous id code which will allow you to take your end of class
survey.
You will need a new code for each class. ";
echo "Go to xxxxxxxxxxxx. Then click on the Survey link.";
echo "Your case sensitive code is :<BR>";
echo "<FONT SIZE='+1'><STRONG>{$row['id']}</STRONG></FONT></P>";
}
}
?>
I should get a page of codes to print. It was working fine. However,
the problem is that when I need more codes I only want
the new ones to print out not the ones that have been already
printed. I thought that I could just set a time and say to print
codes that were generated at a time greater than the time entered.
Instead of codes, I get: Query 2 failed cause: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '18:47:17' at line 1.
When I create the code, I add in timestamp. I changed created to
entered and made varchar(25) in db. It doesn't keep a default value
and leaves what I entered in seconds.
$created = mktime();
$sql= "INSERT into $db_table10 (id, created) VALUES
('$random','$created')" ;
This was not the code in your first post - and you didn't have any code in your second one. That is why I asked.
Your query fails because a datetime value needs to be in single quotes in the query, i.e.
$sql= "SELECT * FROM $db_table10 WHERE created < '$gettime'";
And your other problems are SQL related - not PHP. I suggest you follow up in comp.lang.mysql - which is where you should be asking MySQL-related questions.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- timestamp
- From: up2trouble
- Re: timestamp
- From: up2trouble
- Re: timestamp
- From: Jerry Stuckle
- Re: timestamp
- From: up2trouble
- timestamp
- Prev by Date: Re: Advice on learning PHP
- Next by Date: Re: php5 and include problem
- Previous by thread: Re: timestamp
- Next by thread: Re: timestamp
- Index(es):
Relevant Pages
|