Skip to content

Commit 342197f

Browse files
authored
Merge pull request #31 from JTBrinkmann/patch-1
add mysqli_result() definition to README.md
2 parents 25ddd9b + 8023f6b commit 342197f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,19 @@ See the [wiki](https://github.com/philip/MySQLConverterTool/wiki) for additional
4242
# Limitations
4343
With `short-open-tag` disabled, short tags (<? and <?=) are essentially ignored due to how the `tokenizer` extension works. So, if you use the likes of <? (instead of <?php) then enable `short-open-tag` before executing the conversion otherwise that PHP code will be ignored (not converted). For details, see issue [#16](https://github.com/philip/MySQLConverterTool/issues/16).
4444

45-
Also, a `mysql_result` equivelant does not exist in `ext/mysqli` so you must define `mysqli_result`. The tool does suggest code for this but it does not insert this definition into your converted markup.
45+
Also, a `mysql_result` equivelant does not exist in `ext/mysqli` so you must define `mysqli_result`. The tool does suggest code for this but it does not insert this definition into your converted markup:
46+
47+
```php
48+
function mysqli_result($result, $number, $field=0) {
49+
mysqli_data_seek($result, $number);
50+
$type = is_numeric($field) ? MYSQLI_NUM : MYSQLI_ASSOC;
51+
$out = mysqli_fetch_array($result, $type);
52+
if ($out === NULL || $out === FALSE || (!isset($out[$field]))) {
53+
return FALSE;
54+
}
55+
return $out[$field];
56+
}
57+
```
4658

4759
# Alternatives
4860
The [php7-mysql-shim](https://github.com/dshafik/php7-mysql-shim) PHP library defines all mysql_ functions for you, so simply include it (a single PHP file) and your code should work without a need to convert. It uses ext/mysqli and works fine in PHP 5.3 or greater. There are pros and cons to each approach.

0 commit comments

Comments
 (0)