In need of some help building a website API. I'm trying to build a website API for a film review website and when testing the API in apigee console it's not getting the data from the MySQL tables I have already created.
Might also be worth using Firefox with the Firebug Extension. I use the 'Console' mode on firebug at work, it's great for drilling down into errors in greater detail.
Just run firebug and recreate the issue with the console running.
function film_get() {
$this->load->database();
$sql = 'SELECT * FROM films;';
$query = $this->db->query($sql);
$data = $query->result();
$this->response($data, 200);
}
function films_get($film_id) {
$this->load->database();
$sql = 'SELECT * FROM films WHERE code = "'.$films_id.'";';
$query = $this->db->query($sql);
$data = $query->row();
just sorted it now changed "where code" was to "where id" and on line 23 changed function films to just function film and now it lists the film in my database.
thanks for peoples help may need more in a few minutes
Just a tip with regards to SQL statements (not sure whether you do this already). When I'm writing apps that use some SQL scripting, I normally build/test my scripts in the SQL client (In my case MS SQL Management Studio). This is because I can then see the results/ errors of the script from the native client.
Just a tip with regards to SQL statements (not sure whether you do this already). When I'm writing apps that use some SQL scripting, I normally build/test my scripts in the SQL client (In my case MS SQL Management Studio). This is because I can then see the results/ errors of the script from the native client.