The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
$db->query not returning records
#6
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:
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.
  Reply


Messages In This Thread
$db->query not returning records - by eer3 - 10-10-2017, 08:31 PM
$db->query not returning records - by eer3 - 10-10-2017, 11:36 PM
$db->query not returning records - by Brandin - 10-11-2017, 09:04 AM
$db->query not returning records - by Brandin - 10-16-2017, 04:46 PM
$db->query not returning records - by karsen - 10-16-2017, 05:23 PM
$db->query not returning records - by Brandin - 10-18-2017, 11:05 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)