I have a problem with PHP. It gives me this error
Notice: Undefined index: itemEntry in C:\xampp\htdocs\armory\pages\home.php on line 23 Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\armory\pages\home.php on line 26
Here is my code
<?php
function test1() {
include('config/dbconf.php');
$sql = "SELECT item FROM character_inventory WHERE guid = 1 AND slot BETWEEN 1 AND 18";
$result = mysqli_query($conn, $sql);
while($row = $result->fetch_array()) {
$rows[] = $row;
}
foreach($rows as $row) {
$sql = "SELECT DISTINCT itemEntry FROM item_instance WHERE guid = " . $row['item'] . "";
$result = mysqli_query($conn, $sql);
while($row = $result->fetch_array()) {
$rows[] = $row;
}
foreach($rows as $row) {
mysqli_select_db($conn, "elunaworld");
$sql = "SELECT * FROM item_template WHERE entry = " . $row['itemEntry'] . "";
$result = mysqli_query($conn, $sql);
if(mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo $row['name'] . "<br>";
}
}
}
}
}
echo test1();
?>