ezSQL / ezsql

PHP class to make interacting with a database ridiculusly easy
http://ezsql.github.io/ezsql
GNU Lesser General Public License v3.0
866 stars 291 forks source link

$db->num_rows not working #216

Closed daza110 closed 1 year ago

daza110 commented 2 years ago
$CTasks = $db->get_results("SELECT * FROM a_table WHERE a_id LIKE '921j0jd2' AND p_id LIKE '' ORDER BY execution_order");
$NoTasks = $db->num_rows;

echo "Number of Tasks to start: {$NoTasks}";

This echos: "Number of Tasks to start: " It does not say many rows there are.

ezSQL version 5.1.1 installed via composer so its the latest version

TheTechsTech commented 2 years ago

$NoTasks` = $db->num_rows;s

There is no direct access to any protect method property.

This package really based on the additional shortcut methods. That takes of prepared statements and sql escaping.

I don't see any connection setup, need more info and full

daza110 commented 2 years ago

OK, I have migrated to a new server and whilst doing so decided to use composer to install ezsql. We were using v3.08 which was not installed via composer on the old server.

That allowed $db->num_rows so an awful lot of our scripts and code has this in, which has effectively broke our system.

So as this is a newer version, is there something I have to do now? EG I noticed that $db->debug(); had stopped working too. Until I saw that we now need to declare $db->debugOn();

However I cant see anywhere on the docs which referd to num_rows.

Im not sure what other info you want sorry.

This is how I connect to my DB $db = Database::initialize('mysqli',[_DUSER,_DPASSWORD,_DATABASE,_DHOST],'db');

PHP Version: 7.4 Debian 11

TheTechsTech commented 2 years ago

All the property are accessible by a magic method routine.

There are no underscore in property names, now camelCase, so call by getNumRows().

Anyway you should read branch 4x readme, a whole lot of breaking changes.

daza110 commented 2 years ago

So there is non work around then? I have to go through and change all of my $db->num_rows to $db->getNumRows()

I'll take a look then.

TheTechsTech commented 2 years ago

Yes

daza110 commented 2 years ago

OK if anyone else comes across this issue I did a global update with the following command to batch update this:

grep -rl '$db->num_rows' /path/to/folder | xargs sed -i s@'$db->num_rows'@'$db->getNumRows()'@g