Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I am attempting to insert records into a simple mysql table that looks like:Code: Select all
create table accepts (
id int not null auto_increment,
user varchar(9) not null,
time timestamp not null,
primary key(id)
);Code: Select all
$db = mysql_connect("localhost", "root");
$ts = time();
mysql_select_db("confirmations", $db);
$sql = "insert into accepts (user, pin, time) values ('" .
$_REQUEST['user'] . "', '" . $_REQUEST['pin'] . "', " . $ts . ")";
$result = mysql_query($sql);Code: Select all
mysql> select * from accepts;
+----+------+--------+----------------+
| id | user | pin | time |
+----+------+--------+----------------+
| 1 | rkg | 123123 | 00000000000000 |
| 2 | rkg | 123123 | 00000000000000 |
| 3 | rkg | 123123 | 00000000000000 |$sql string that looks quite right--with a non-zero int value for timestamp
(That looks like about the right number of seconds since Jan 1, 1970.
I am new to php but have been doing the same in Java for years. I must
be missing something obvious.
Any hints?
Thanks, Rob
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]