Note that there are some explanatory texts on larger screens.

plurals
  1. POMysql Insert Error can not find the issue
    primarykey
    data
    text
    <p>Hi I am using the code below, and have been through it lots of times but can not see why this isn't working, I think it is just a case of not being able to see the problem for looking, so I would be grateful if somebody else could have a look and identitfy the problem.</p> <p>this is the error I am getting; </p> <pre><code>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Azur', 'Antibes', '43.5624', '7.1278', '', '', 'Europe/Paris', 'EU', '', 'Amadeu' at line 6 </code></pre> <p>And here is the code:</p> <pre><code> if (!isset($params['i'])) $params['i'] = '82.150.248.29'; $query = 'https://geoip.maxmind.com/e?' . http_build_query($params); $omni_keys = array( 'country_code', 'country_name', 'region_code', 'region_name', 'city_name', 'latitude', 'longitude', 'metro_code', 'area_code', 'time_zone', 'continent_code', 'postal_code', 'isp_name', 'organization_name', 'domain', 'as_number', 'netspeed', 'user_type', 'accuracy_radius', 'country_confidence', 'city_confidence', 'region_confidence', 'postal_confidence', 'error' ); $curl = curl_init(); curl_setopt_array( $curl, array( CURLOPT_URL =&gt; $query, CURLOPT_USERAGENT =&gt; 'MaxMind PHP Sample', CURLOPT_RETURNTRANSFER =&gt; true ) ); $resp = curl_exec($curl); if (curl_errno($curl)) { throw new Exception('GeoIP Request Failed'); } $omni_values = str_getcsv($resp); $omni = array_combine( $omni_keys, $omni_values); //print_r($omni_values); $country_code= $omni['country_code']; $country_name= $omni['country_name']; $region_code= $omni['region_code']; $region_name= $omni['region_name']; $city_name= $omni['city_name']; $latitude= $omni['latitude']; $longitude= $omni['longitude']; $metro_code= $omni['metro_code']; $area_code= $omni['area_code']; $time_zone= $omni['time_zone']; $continent_code= $omni['continent_code']; $postal_code= $omni['postal_code']; $isp_name= $omni['isp_name']; $organization_name= $omni['organization_name']; $domain= $omni['domain']; $as_number= $omni['as_number']; $netspeed= $omni['netspeed']; $user_type= $omni['user_type']; $accuracy_radius= $omni['accuracy_radius']; $country_confidence= $omni['country_confidence']; $city_confidence = $omni['city_confidence']; $region_confidence= $omni['region_confidence']; $postal_confidence= $omni['postal_confidence']; $error= $omni['error']; //Insert to MasterTable mysql_query("INSERT INTO mastertable (country_code, country_name, region_code, region_name, city_name, latitude, longitude, metro_code, area_code, time_zone, continent, postal_code, isp_name, organisation, domain_name, as_number, netspeed, user_type, accuracy_radius, country_confidence_factor, city_confidence_factor, region_confidence_factor, postal_code_confidence_factor, error) VALUES ('$country_code', '$country_name', '$region_code', '$region_name', '$city_name', '$latitude', '$longitude', '$metro_code', '$area_code', '$time_zone', '$continent_code', '$postal_code', '$isp_name', '$organization_name', '$domain', '$as_number', '$netspeed', '$user_type', '$accuracy_radius', '$country_confidence', '$city_confidence', '$region_confidence', '$postal_confidence', '$error' ) ") or die(mysql_error()); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload