Connection is successful. No typo's were made (look below). If read it from top to bottom, some of the tests that I show you will seem stupid. Until you look at the end (still keep reading from top to bottom) and find out that it's one of the indicators.
SQL command SELECT * FROM forums
, results in the only two rows in forums
being shows. 2 rows, 8 columns, exactly as it should be.
Database has been connected. PHP says:
$result = mysqli_query($dbconn, "SELECT * FROM forums");
var_dump($result);
Brings:
object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(8) ["lengths"]=> NULL ["num_rows"]=> int(2) ["type"]=> int(0) }
Especially this part: ["num_rows"]=> int(2)
.
Next line:
$result = mysqli_fetch_row($result);
var_dump($result);
Results in only first row being shown:
array(8) { [0]=> string(1) "1" [1]=> string(11) "Primo Forum" [2]=> string(23) "Primo Forum Descriptini" [3]=> string(3) "F00" [4]=> string(1) "0" [5]=> string(11) "11Exampleur" [6]=> string(4) "1234" [7]=> string(4) "9991" }
2nd row missing, even though they're next to each other, in same table, matches query, and is being found by the SELECT query, but... doesn't show.
Now for the weirdest stuff. Saying:
$result = mysqli_query($dbconn, "SELECT * FROM forums");
$result = mysqli_fetch_row($result);
foreach($result as $data) {
echo $data["name"];
}
Gives:
Warning: Illegal string offset 'name' in C:\###\index.php on line 21
1
Warning: Illegal string offset 'name' in C:\###\index.php on line 21
P
Warning: Illegal string offset 'name' in C:\###\index.php on line 21
P
Warning: Illegal string offset 'name' in C:\###\index.php on line 21
F
Warning: Illegal string offset 'name' in C:\###\index.php on line 21
0
Warning: Illegal string offset 'name' in C:\###\index.php on line 21
1
Warning: Illegal string offset 'name' in C:\###\index.php on line 21
1
Warning: Illegal string offset 'name' in C:\###\index.php on line 21
9
What you see after every warning. Is the very first character of the first row of every column.
Dumping the table creates this:
INSERT INTO `forums` (`id`, `name`, `description`, `color`, `visibilityRequirement`, `lastTopicAuthor`, `lastTopicId`, `topicCount`) VALUES
(1, 'Primo Forum', 'Primo Forum Descriptini', 'F00', 0, '11Exampleur', 1234, 9991),
(2, 'Dual Forumo', 'Dual Forumo Descriptini', '0F0', 0, '22Exampleur', 2345, 9992);
Ask what you need for this solution.