对于以下sql语句(在php中):
$sql = "CREATE TABLE {$value}_GAMES ( ". // Creating a new table for each team
"nfl_game_id INT NOT NULL, ".
"team VARCHAR(3) NOT NULL, ".
"opponent VARCHAR(3) NOT NULL, ".
"totfd INT NOT NULL, ".
"totyds INT NOT NULL, ".
"pyds INT NOT NULL, ".
"ryds INT NOT NULL, ".
"pen INT NOT NULL, ".
"penyds INT NOT NULL, ".
"trnovr INT NOT NULL, ".
"pt INT NOT NULL, ".
"ptyds INT NOT NULL, ".
"ptavg INT NOT NULL, ".
"PRIMARY KEY ( nfl_game_id ));";
$retval = mysql_query($sql, $con); // Execute SQL Code
if(! $retval)
{
die('Could not create table: ' . mysql_error());
$sql = "INSERT INTO {$value}_GAMES(nfl_game_id, team, opponent, totfd, ".
"totyds, pyds, ryds, pen, penyds, trnovr, pt, ptyds, ptavg)".
"VALUES('$game', '$team', '$opponent', '$totfirstdown', '$totyds',".
"'$pyds', '$ryds', '$pen', '$penyds', '$trnovr', '$pt', '$ptyds', ".
"'$ptavg')";
$ret_val = mysql_query($sql,$con); // Execute SQL Code
if(! $ret_val)
{
die('Could not add JSON data to table: ' . mysql_error());
}
我收到以下错误:
无法将JSON数据添加到表:不正确的整数值:''for 第1行第'nfl_game_id'栏
当我回应API调用时,这就是数据的样子:
[{"nfl_game_id":2009081350,"team":"ARI","opponent":"PIT","totfd":22,"totyds":329,"pyds":259,"ryds":70,"pen":4,"penyds":27,"trnovr":2,"pt":6,"ptyds":266,"ptavg":37}, .....
知道发生了什么事吗?