E
E
eSCphr2018-02-07 14:13:44
PHP
eSCphr, 2018-02-07 14:13:44

The problem with auto increment, what could be the problem?

Hello, when I add an ID to a table and do auto increment on it, then my data stops being written to the database after authorization, what could be the problem?
Here is the code, initially when the table without auto increment everything works fine

$ipcountry = json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip)) -> {'geoplugin_countryName'};
if (empty($ipcountry)) {$ipcountry = 'XX';}
$SQL = $odb -> prepare('INSERT INTO `loginlogs` VALUES(:username, :ip, UNIX_TIMESTAMP(), :ipcountry)');
$SQL -> execute(array(':ip' => $ip, ':username' => $username, ':ipcountry' => $ipcountry));

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
eSCphr, 2018-02-07
@eSCphr

Everything I did used the null value

$SQL = $odb -> prepare('INSERT INTO `loginlogs` VALUES(NULL, :username, :ip, UNIX_TIMESTAMP(), :ipcountry)');

B
Boris Korobkov, 2018-02-07
@BorisKorobkov

RTFM php.net/manual/ru/pdo.errorinfo.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question