Hi, I'm looking for a many-in-one PHP MySQL 1 class/file with the features:
- Connect to DB server
- Select database
- CRUD
- Prepare & binding
Thank you in advance!
Hi, I'm looking for a many-in-one PHP MySQL 1 class/file with the features:
Thank you in advance!
After a quick search I found this.
You could modify / extend it to suit your needs.
Here is a little something I wrote a while back:
Then you can just query as such:
$mysql = new MySQL('localhost', 'user', 'password', 'somedb');
$mysql->open();
$result = $mysql->query("SELECT field FROM table WHERE field = '%s';", 'Some Value');
while($row = $mysql->fetch($result)) { echo $row['field']; }
It will automatically escape your values, provided you use sprintf()
type syntax. Not exactly what you asked but close.
For a more complete package, you might want to look at PEAR::MDB2.