I have simple msql based glossary - which stop working after upgrade from php5.4 to php 5.6.28
In form i send a variable to address like page.php?word=xxx
in page.php it should get $word from table.word with table.definition
Connection with database is working.
Error log looks
array(1) { ["word"]=string(5) "xxx" } bool(true)
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given
my code is
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$configfile = "config.php";
require $configfile;
$db = mysqli_connect("$host", "$username", "$password") or die ("could not connect to mysql");
mysqli_select_db($db, "$databasename") or die ("no database");
mysqli_query($db, "SET NAMES 'utf8' COLLATE 'utf8_polish_ci'");
function mysqli_result($db,$row=0,$col=0){
$numrows = mysqli_num_rows($db);
if ($numrows && $row <= ($numrows-1) && $row >=0){
mysqli_data_seek($db,$row);
$resrow = (is_numeric($col)) ? mysqli_fetch_row($db) : mysqli_fetch_assoc($db);
if (isset($resrow[$col])){
return $resrow[$col];
}
}
return false;
}
$word = "";
var_dump($_GET);
var_dump(isset($word));
if($word)
{
$getWord=mysqli_query($db, "SELECT word,definition FROM mdglossary WHERE word LIKE '$word' ORDER BY word");
}
else {....}
if($getWordArray=mysqli_fetch_array($getWord, MYSQLI_BOTH))
{
do
{
echo "....";
}
while($getWordArray=mysqli_fetch_array($getWord));
}
else {....}
I try to find solution "hundret" times by Internet and this page, but I just can't understand what happened and why it doesn't work at all.