Recommend this page to a friend! |
Download .zip |
Info | Example | Screenshots | View files (12) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-01-04 (1 month ago) | Not enough user ratings | Total: 57 This week: 1 | All time: 10,479 This week: 75 |
Version | License | PHP version | Categories | |||
php-mysql-handling-c 1.0 | MIT/X Consortium ... | 5 | PHP 5, Databases |
Description | Author | ||||||||
This class can execute common MySQL database queries using MySQLi. |
|
This document provides instructions and examples for using the MySql PHP class to perform database operations such as single insert, select, and join. These examples assume that you have already set up the MySql class and have the necessary database credentials.
Below are the PHP code snippets for each of these operations:
Function: singleInsertTest
function singleInsertTest() {
$sql = new MySql(Database::test, UserConnection::username, UserConnection::password);
$table = MySql::Table("your_table_name");
$table->insert(array("ColumnName1" => "Value1", "ColumnName2" => "Value2"));
if ($table->CheckOutInsert()) {
echo "Insert successful";
} else {
echo "Insert not successful";
}
}
Function: selectTest
function selectTest() {
$sql = new MySql(Database::test, UserConnection::username, UserConnection::password);
$table = MySql::Table("your_table_name");
$table->select(array("ColumnName1" => "", "ColumnName2" => "SpecificValue"));
$output = $table->CheckOutSelect();
if ($output != null) {
while ($row = $output->fetch_assoc()) {
echo "Data: " . $row["ColumnName1"] . "
";
}
}
}
Function: innerJointest
function innerJointest() {
$sql1 = new MySql(Database::test, UserConnection::username, UserConnection::password);
$table1 = MySql::Table("first_table_name");
$table1->select(array("id" => "", "ColumnName" => "Value"));
$sql2 = new MySql(Database::test, UserConnection::username, UserConnection::password);
$table2 = MySql::Table("second_table_name");
$table2->select(array("ForeignKey" => "", "AnotherColumn" => ""), true);
$table1->INNERJOIN($table2);
$table1->ON([[$table1->getTablecol("id"), $table2->getTablecol("ForeignKey")]]);
$output = $table1->CheckOutSelect();
if ($output != NULL && $output->num_rows > 0) {
while ($row = $output->fetch_assoc()) {
var_dump($row);
}
}
}
<?PHP |
This repository contains a PHP class for handling MySQL database connections and operations. The class provides a convenient way to connect to a MySQL server, execute queries, and perform common database operations.
The MySql
class is designed to simplify the interaction with a MySQL database in PHP. It provides methods for establishing a connection to the database, executing SQL queries, and handling exceptions. The class also supports customizable error handling and provides functionality for constructing common SQL statements such as SELECT, INSERT, and DELETE.
To use the MySql
class, follow these steps:
Please refer to the code documentation and examples for detailed usage instructions and API references.
This project was developed to simplify MySQL database handling in PHP applications. We would like to acknowledge the developers and contributors of PHP and MySQL for their excellent work in creating these powerful technologies.
Contributions to this project are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request. Let's make this MySQL PHP handling class even better together.
This project is licensed under the MIT License. Feel free to use, modify, and distribute the code in accordance with the terms of the license.
Screenshots | ||
Files |
File | Role | Description |
---|---|---|
AbstractClasses.php | Class | Class source |
headers.php | Aux. | Auxiliary script |
IException.php | Class | Class source |
insertTest.php | Example | Example script |
LICENSE | Lic. | License text |
MySql.php | Class | Class source |
MySqlKeyword.php | Class | Class source |
README.md | Doc. | Documentation |
selectTest.php | Example | Example script |
Table.php | Class | Class source |
TableColumn.php | Class | Class source |
Utility.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
92% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.