IATA and ICAO

FREE
By leopieters | Updated 3 months ago | Travel
Popularity

0.5 / 10

Latency

825ms

Service Level

100%

Back to All Discussions

Keep getting `SQLSTATE[42000]: Syntax error or access violation` error

A
abhig01
4 years ago

Below is my code

	Unirest\Request::verifyPeer(false);
	$response = Unirest\Request::get("https://leopieters-iata-and-icao-v1.p.mashape.com/airportDatabase?codeIataAirport=BOM&key='".MASHAPE_IATA_CODE_API_KEY."'",
		array(
			"X-Mashape-Key" => MASHAPE_IATA_CODE_API_KEY,
			"Accept" => "text/plain"
		));

	print_r($response);

Here is the response

    Unirest\Response Object
    (
        [code] => 200
        [raw_body] => {"error": {"text": SQLSTATE[42000]: Syntax error or access violation: 1064 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 '{key}''' at line 1}
        [body] => {"error": {"text": SQLSTATE[42000]: Syntax error or access violation: 1064 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 '{key}''' at line 1}
        [headers] => Array
            (
                [0] => HTTP/1.1 200 OK
                [Access-Control-Allow-Headers] => X-Requested-With, Content-Type, Accept, Origin, Authorization
                [Access-Control-Allow-Methods] => GET, POST, PUT, DELETE, OPTIONS
                [Access-Control-Allow-Origin] => *
                [Content-Type] => text/html; charset=UTF-8
                [Date] => Sat, 03 Feb 2018 06:46:51 GMT
                [Host-Header] => 192fc2e7e50945beb8231a492d6a8024
                [Server] => Mashape/5.0.6
                [X-Proxy-Cache] => MISS
                [Content-Length] => 274
                [Connection] => keep-alive
            )
    )

Join in the discussion - add comment below:

Login / Signup to post new comments
Rating: 2 - Votes: 4