Hi guys,
i'm a bit new to PHP / Cake PHP, so go easy on me!
I'm trying to POST some key/values to a method within one of my API Controllers.
I'm not having any luck with it seeing the key/value i'm passing it though.
I'm trying to pass the method below islocationlive with a postcode (String).
It will then take this postcode, and check it against the table in my database.
When i hard core the postcode like below, it works. But i want to pass the argument in via Postman.
See attached.
When i do it this way, it doesnt see it. I get Missing argument/undefined variable errors.
Any thoughts?
public function api_islocationlive($postcode = '6000')
{
$live = ' ';
$live = $this->Order->query("SELECT * FROM postcodes WHERE postcode = " . $postcode . " AND is_live='Y'");
if ($live) {
echo $result['successfull'] = 'true';
} else {
echo $result['successfull'] = 'false';
}
}
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment