10-16-2017, 05:23 PM
Brandin is definitely correct about binding, but I want to chime in to your original problem. Your sql was invalid and so the $db object wasn't able to get the rows.
If you look at the queryString property of your print_r(), the query you sent the database was:
You'd need to add quotes around your token, to make it:
When you bind your variables the code knows to add in your quotes for you though as well as helping prevent SQL injection, so it's definitely recommended to bind them any time you use non-static values.
If you look at the queryString property of your print_r(), the query you sent the database was:
Code:
SELECT * FROM apps_project WHERE token = oimevmvlaeccuspb0dtzq6y3xrig4jwt;
You'd need to add quotes around your token, to make it:
Code:
SELECT * FROM apps_project WHERE token = 'oimevmvlaeccuspb0dtzq6y3xrig4jwt';
When you bind your variables the code knows to add in your quotes for you though as well as helping prevent SQL injection, so it's definitely recommended to bind them any time you use non-static values.