├── LICENSE ├── README.md └── php7-mysql.php /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Pavel Tzonkov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # php7-mysql 2 | This PHP script emulates MySQL extension for PHP 7 using MySQLi extension 3 | 4 | Just include the PHP file on top of your old application and it will work with old mysql_*() functions. 5 | 6 | Not implemented functions: 7 | * mysql_field_flags() 8 | * mysql_list_processes() 9 | * mysql_tablename() 10 | -------------------------------------------------------------------------------- /php7-mysql.php: -------------------------------------------------------------------------------- 1 | length : false; 241 | } 242 | 243 | function mysql_field_name($qlink, $offset) { 244 | $field = mysqli_fetch_field_direct($qlink, $offset); 245 | if (!is_object($field)) 246 | return false; 247 | /**/return empty($field->orgname) ? $field->name : $field->orgname; 248 | } 249 | 250 | function mysql_field_table($qlink, $offset) { 251 | $field = mysqli_fetch_field_direct($qlink, $offset); 252 | if (!is_object($field)) 253 | return false; 254 | /**/return empty($field->orgtable) ? $field->table : $field->orgtable; 255 | } 256 | 257 | function mysql_field_type($qlink, $offset) { 258 | $field = mysqli_fetch_field_direct($qlink, $offset); 259 | return is_object($field) ? $field->type : false; 260 | } 261 | 262 | function mysql_free_result($qlink) { 263 | try { 264 | mysqli_free_result($qlink); 265 | } catch (Exception $e) { 266 | return false; 267 | } 268 | return true; 269 | } 270 | --------------------------------------------------------------------------------