Connect Arduino and phpMyadmin

thanasisloi7:
Wonderful its working. Now i want only to store the time and the date in the database in the same row

Do:

ALTER TABLE temperatures ADD date TIMESTAMP FIRST;

This will add a column named "date" as the first column in the table. It will automatically be set to the current date/time whenever an insert occurs into the table -- no need to make any changes to your Arduino or PHP code.

mysql> describe temperatures;
+-------+-------+------+-----+---------+-------+
| Field | Type  | Null | Key | Default | Extra |
+-------+-------+------+-----+---------+-------+
| temp1 | float | YES  |     | NULL    |       |
| temp2 | float | YES  |     | NULL    |       |
+-------+-------+------+-----+---------+-------+
2 rows in set (0.03 sec)

mysql> alter table temperatures add date timestamp first;
Query OK, 0 rows affected (0.08 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> describe temperatures;
+-------+-----------+------+-----+-------------------+-----------------------------+
| Field | Type      | Null | Key | Default           | Extra                       |
+-------+-----------+------+-----+-------------------+-----------------------------+
| date  | timestamp | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| temp1 | float     | YES  |     | NULL              |                             |
| temp2 | float     | YES  |     | NULL              |                             |
+-------+-----------+------+-----+-------------------+-----------------------------+
3 rows in set (0.00 sec)

mysql> insert into temperatures (temp1, temp2) values (1.1, 2.2);
Query OK, 1 row affected (0.04 sec)

mysql> select * from temperatures;
+---------------------+-------+-------+
| date                | temp1 | temp2 |
+---------------------+-------+-------+
| 2013-01-16 10:51:58 |   1.1 |   2.2 |
+---------------------+-------+-------+
1 row in set (0.02 sec)

mysql>