📂 A robust and easy-to-use PHP class for managing MySQL databases with PDO. This class provides a wide range of functionalities to handle databases, tables, and data with ease.
- 🔗 Database Connection: Easily connect to MySQL databases using PDO.
- 🛠️ Database Management: Create and delete databases effortlessly.
- 📊 Table Operations: Create, delete, rename, and modify tables.
- 🔧 Column Operations: Add, delete, rename, and modify columns.
- 🔑 Foreign Keys: Add foreign keys with support for
ON DELETE
andON UPDATE
actions. - 📝 Data Operations: Insert, select, update, and delete data with ease.
- ✅ Error Handling: Built-in error handling to ensure smooth operations.
- PHP 7.0 or higher
- MySQL database
- PDO extension enabled
- Clone the repository or download the
Database.php
file.git clone https://github.com/yourusername/your-repo-name.git
- Include the
Database.php
file in your project.require_once 'path/to/Database.php';
$db = new Database('hostname', 'database_name', 'username', 'password');
$columns = [
'id' => 'INT AUTO_INCREMENT PRIMARY KEY',
'name' => 'VARCHAR(100) NOT NULL',
'email' => 'VARCHAR(100) NOT NULL'
];
$db->createTable('users', $columns);
$data = [
'name' => 'John Doe',
'email' => '[email protected]'
];
$db->insert_Into_Table('users', $data);
$result = $db->select_From_Table('users', ['id', 'name', 'email'], "name LIKE '%John%'");
print_r($result);
$data = [
'email' => '[email protected]'
];
$db->update_Table('users', $data, "id = 1");
$db->delete_From_Table('users', "id = 1");
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
- Fork the project.
- Create your feature branch (
git checkout -b feature/AmazingFeature
). - Commit your changes (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a pull request.