php - sql query was working and now not? insert user ip address into table? -
my sql query working fine 5 hours ago , it's not? have not touched thing.
can please me bottom of this, should users ip address , store in table along current time , date, not inserting anything, appreciate help.
here table:
+-------------------------------------------------------------+ |session_id | user_ip | session_start | session_end| |===========|================|===================|============| | 1| 192.135.123.13| 23:02:20 10:23 | null | +-------------------------------------------------------------+
here sql:
// ip address $sql = "insert ptb_sessions (session_id, user_ip, session_start, session_end) values (null, '" . $_server['remote_addr'] . "', now(), null);"; mysql_query($sql, $connection); ?>
go step step.
- try inserting simplest data values sets
(1, '127.0.0.1', now(), now())
- if ok, try adding
$_server['remote_addr']
instead of127.0.0.1
be careful case in tables , columns names.
if 1 not work in php code, try execute sql insert directly mysql gui (mysql workbench example), error should raised.
if insertion works fine mysql gui, check connection parameters in php.
Comments
Post a Comment