Joined November 2012
·
Jonathan tavares

Jonathan Tavares

Sapo.pt
Sapo.pt
·
Lisbon, Portugal
·
·
·

With slim there are ways of creating optional parameters, that example would result in a route like this: /items(/:idParam)(/count)

I realy find Slim the most elegant PHP "router" (wouldn't really call it a framework).

Cheers!,

Posted to Simple MySQL wrapper using mysqli_* over 1 year ago

@kunalvarma05 Aliases are alternative names for methods, in a way that you can somehow dislike the "fetch" term and feel more confortable with "get", this depends from your experience with other db drivers, some use fetch, some use get, I figured I should offer both options.

Posted to Simple MySQL wrapper using mysqli_* over 1 year ago

@kunalvarma05 You'r right! thanks, I updated the readme

Posted to Simple MySQL wrapper using mysqli_* over 1 year ago

Hey @kunalvarma05 !
There are diferent ways of doing it,
First, the fetch methods will return false if the recordset is empty, for example if you do somethign like:
if( $row=$result->fetch() ){ //something }
It will work only be true if fetch() returns anything.
another way is using loops, a while loop works the same way as the exaple above.
Assibe from this you have a method to check the record existance, try using:

if( $result->is_empty() ){ echo "result empty"; }else{ echo "record not empty"; }

for more info on this check the readme.md on github:
https://github.com/entomb/OBJ-MySQL/blob/master/README.md

Posted to Simple MySQL wrapper using mysqli_* over 1 year ago

@gonedark I understand you point, and its valid, but this class aims to be simpler than PDO, I wouldn't recomend using it for anything that requires the use of all database functionality.

on the other and, a small 2 file class performs better on small applications such as cronjobs or simple "registration" scrips or campaigns where there is no need to overkill the code with unecessary functionalities. It's all about the right tool for the job, and PDO (or any other dba you can find online) is powerfull and full or features it becomes complicated to use on small scale scripts.

As for the methods mapped, the class aims to spare you precious lines of code on pre-checks or input validations, as the native PHP driver trusts everything you send him, also, insert() update() and delete() methods provide a simple and straight forward way of interact with the DB impossible to achive with hand typed queries.

thanks for the feedback!

Posted to Simple MySQL wrapper using mysqli_* over 1 year ago

@kunalvarma05 Thanks! make sure to report back any bug/feature requests!

Achievements
621 Karma
42,749 Total ProTip Views