Download the PHP package steinhaug/mysqli without Composer

On this page you can find all versions of the php package steinhaug/mysqli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mysqli

Mysqli2

Mysqli Abstraction Layer v1.6.6

# Table of Contents - [Mysqli2](#mysqli2) - [Table of Contents](#table-of-contents) - [1. Description](#1-description) - [2. Version History](#2-version-history) - [2.1 Log](#21-log) - [v1.6.6](#v166) - [v1.6.5](#v165) - [v1.6.4](#v164) - [v1.6.3](#v163) - [v1.6.2](#v162) - [3. Install by composer](#3-install-by-composer) - [4. Code Examples](#4-code-examples) - [4.1 Init](#41-init) - [4.2 Query](#42-query) - [5. Information](#5-information) - [5.1 License](#51-license) - [5.2 Author](#52-author)

1. Description

Mainly for development and logging of queries, but now that the class is up and running future releases should be expected to do the heavy lifting of queries and iteration.

2. Version History

2.1 Log

v1.6.6

- Updated readme.

v1.6.5

- Bugfix, error_number has to be int

v1.6.4

- buddy() updated, has prepared output aswell. echo $mysqli->buddy('table','insert','prepared');
- parse_col_type, added prepared for type

v1.6.3

- Added mode for ->result('assoc') without using second parameter.

v1.6.2

- Updated for PHP 8.1  

3. Install by composer

To install the library use composer:

composer require steinhaug/mysqli

4. Code Examples

4.1 Init

We want this to be a replacement for the existing $mysqli function in PHP so initialize your DB connection, using credentials from credentials.php in project.

$mysqli = Mysqli2::getInstance($mysql_host, $mysql_port, $mysql_user, $mysql_password, $mysql_database);

if ($mysqli->connect_errno) {
    echo 'Failed to connect to MySQL: (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error;
}

if (!$mysqli->set_charset("utf8")) {
    printf("Error loading character set utf8: %s\n", $mysqli->error);
    exit();
}

4.2 Query

Prepared query, quick query returns associated array:

$TestID = 1;
$row = $mysqli->prepared_query1('SELECT * FROM `zzz_testtable` WHERE `TestID`=?', 'i', [$TestID], true);
if($row===null){
    throw new Exception('prepared_query1(sql,true) error');
}

Prepared query, results comes in array

$TestID = 5;
$resultset = $mysqli->prepared_query('SELECT * FROM `zzz_testtable` WHERE `TestID`=?', 'i', [$TestID]);
if( !count($resultset) ){
    throw new Exception('prepared_query() returned unexpected result');
}
// echo $resultset[0]

Prepared delete:

$TestID = 1;
$UserID = 1;
$affected_rows = $mysqli->prepared_query('DELETE FROM `zzz_testtable` WHERE `TestID`=? AND `user_id`=?', 'ii', [$TestID, $UserID]);
if (!$affected_rows) {
    throw new Exception('prepared_query(delete from...) reported 0 deletion');
}

Prepared insert:

$sql = [
    'INSERT INTO `table_name` (`col_name`, `col_name_two`, `col_name_three`, `col_name_four`, `col_name_five`) VALUES (?,?,?,?,?)',
    'issds',
    [$variable, '2020-01-01 00:00:00', 'test/[email protected]', 1.23, '2020-01-01 00:00:00'],
];
$InsertId = $mysqli->prepared_insert($sql);
if (!$InsertId) {
    throw new Exception('prepared_insert(insert into) inserted_id error');
}

5. Information

5.1 License

This project is licensed under the terms of the MIT License. Enjoy!

5.2 Author

Kim Steinhaug, steinhaug at gmail dot com.

Sosiale lenker: LinkedIn, SoundCloud, Instagram, Youtube, X, Ko-Fi, Github, Gitlab

Generative AI lenker: Udio, Suno, Huggingface

Resurser og hjelpesider: Linktr.ee/steinhaugai, Linktr.ee/stainhaug, pinterest/steinhaug, pinterest/stainhaug


All versions of mysqli with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.0
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package steinhaug/mysqli contains the following files

Loading the files please wait ....