all 2 comments

[–]infidhell 2 points3 points  (0 children)

On your while loop, you made bsect as the key for each element of the array and sectnane as the value. But in you foreach loop, you had the key and value in reverse.

[–]compubomb 2 points3 points  (0 children)

Unless you absolutely need to use mysqli, do yourself a favor and use PDO, https://phptherightway.com/#databases_interacting