I have a table full of names and I have a stored procedure that returns all of the names. However it is not doing what I expect it to do and I can't pinpoint the problem even with log. Instead of getting a drop down list of actual names, I'm getting a drop down of blank values as if I can actually select a value, but console.log displays a empty value, which I'm assuming means it's null
connection.php
<?php
require 'credentials.php';
include '../ChromePhp.php';
$con = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($con->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
ChromePhp::warn('something went wrong!'); // didn't reach here
}
?>
This calls retrieveAllPokemonNames.php
<?php
include '../database/retrieveAllPokemonNames.php';
while ($row = $result->fetch_assoc()){
echo "<option value= ".$row[0].">".$row[0]."</option>";
}
?>
retrieveAllPokemonNames.php
<?php
require 'connection.php';
$sql = "CALL sp_selectAllPokemonName";
if ($result = $con->query($sql)){
ChromePhp::log('query is successful'); // output
ChromePhp::log($result); // log outputs a Object { current_field: null, field_count: null, .....etc }
}
?>
The SQL query works fine when I call it in phpMyAdmin's interface and sp_selectAllPokemonName
is basically
Select * From PokemonName
which returns ~100 rows