If I use the below code, it works
$query = 'SELECT * FROM messages ORDER BY date DESC LIMIT ? , ?';
But if I use WHERE clause to filter the exact user data, it shows error
$query = 'SELECT * FROM messages WHERE member_name='.$userid.' ORDER BY date DESC LIMIT ? , ?';
Here is the full error
Fatal error: Uncaught Error: Call to a member function execute() on bool in /home/customer/www/sitename.com/public_html/user/notifications/lib/DataSource.php:82 Stack trace: #0 /home/customer/www/sitename.com/public_html/user/notifications/Model/Pagination.php(41): Phppot\DataSource->select('SELECT * FROM m...', 'ii', Array) #1 /home/customer/www/sitename.com/public_html/user/notifications/index.php(7): Phppot\Pagination->getPage() #2 {main} thrown in /home/customer/www/sitename.com/public_html/user/notifications/lib/DataSource.php on line 82
The funny thing is, I am using the same script with WHERE clause in another website.
but what could cause such an error ?
The $userid
string has value, already checked and all included/connected php files are also working.
The code is from this website