我有以下數組:如何將數組插入到mysql數據庫中?
$dati = array(
"data" => array(
'address_complete'=>$data->results[0]->formatted_address,
'address_square'=>$data->results[0]->address_components[1]->long_name,
'location'=>$data->results[0]->address_components[2]->long_name,
'postal_code'=>$data->results[0]->address_components[7]->long_name,
'data_ora'=>$tmp_date
)
);
,我想插入$dati["data"]['location'] in database.
如何解決
mysql_query("INSERT into utenti(city) VALUES ('$dati[data][location]')") or die (mysql_error());
?
變化'$ DATI [數據] [位置]''到$ DATI [ '數據'] [ '位置']'? – Maximus2012
目前發生了什麼? – chris85
首先,使用[mysqli的(http://stackoverflow.com/questions/8891443/when-should-i-use-mysqli-instead-of-mysql) –