Комментарии:
Is there a reason why you used print_r() instead of echo?
ОтветитьHello, everything works well except the writing in the database, it puts + between each word (instead of space) Thank you
ОтветитьHas the area been abandoned?????
ОтветитьHi just tried ur instruction and code today 6-24-2022 it worked great. would it be a lot of trouble to use/add the ability for a api key that i assign to him and her etc.
ОтветитьHey Brad. Love your videos. However, I have this weird error on postman where it says
"Header may not contain more than as ingle header, new line detected in
:\XAMPP\htdocs\php_rest_myblog\api\post\create.php</b> on line <b>6</b><br />
And then on each value I get 4 individual errrors stating
<b>Warning</b>: Attempt to read property "title" on null in <b>C:\XAMPP\htdocs\php_rest_myblog\api\post\create.php</b>
on line <b>24</b><br />
Has anyone else had these issues? Or is it just a hard bug?
Hi, If you return the variable $row, and do echo json_encode($row) you obtain the same result. Is it really useful do it in your way?
ОтветитьReally great stuff! Just finished building API for a client that sends Woocommerce orders to their CMR. Before these 2 tutorials, I had no idea how to do that :). Of course a ton of StackOverflow reading was involved, but fundament came from here. Thank you very much for your great work!
Ответитьhow to solve this problem ? PHP Notice: Trying to get property 'title' of non-object
Ответитьits active record?
ОтветитьHi Brad.. first let me mention that your tutorial illustrations are nothing short of AWESOME!!!!.. You rock!!..
Now I followed step by step but got stuck at $stmt->execute(). I have tried different techniques to catch the error num but to no avail. I am really lost.
If any of you have similar experiences please share what you did to overcome it please. Thank you.
like read in independent file like other methods, is it necessary ?
Ответитьso, from the full angel view, the api files are just like the normal files but the diff only overwrite the methods written in the original files in modules ?
ОтветитьHello brad, can u continue this series by implementing token, so only certain people that have token only can access this api...
ОтветитьIf like me you are finicky about stuff, with the read_single function in the Post.php class you can add some code to stop the output of null JSON for when a user enters an ID that is not in the database (this may not be the best solution but it works when testing using Postman, alternatively it could be handled in the frontend I suppose) -
if(!$row) {
echo 'ID not found';
exit();
} else {
$this->title = $row['title'];
$this->body = $row['body'];
$this->author = $row['author'];
$this->category_id = $row['category_id'];
$this->category_name = $row['category_name'];
}
thanks
ОтветитьI have been looking for this for a long time!!! Thank you so much!!
@everbody has anyone succeeded in transforming this from single post row to mulitple post row? i belive i need to modify the create.php code after $data variable gets populated with json_decode ... Everything after that line needs to be somehow wrapped into foreach or something :D
regards
Hi, can you please guide how can we upload image? Thanks.
ОтветитьThank you very much!!!!
ОтветитьA bit of an older video but can you explain why youre encoding the input before its indexed in the db? I noticed in the first video you also decoded this information to read it. I think it is best to leave inputs structured how they were entered for storing in the db since they will have no affect on the db. That also allows the input to be used elsewhere (if needed) more easily.
Ответить