Just thought I would update. I have it working, finally but I did run into one really weird thing that I never did figure out. Below is the code to make the array.
$query = "SELECT isbn, bookTitle, bookAuthor, bookCond, thumbnail, price FROM BooksforSell WHERE isbn='".$bookSearch."'";
//executes a query and returns results
$result = mysqli_query($dbConnect, $query);
//assigns the number of rows returned from the query
$numRows = $result->num_rows;
$i = 0; //create index and set to 0
$bookInfo = array(); //create a new empty array
//iterate through and fill array with data
while($row = mysqli_fetch_array($result, MYSQLI_NUM)){
$bookInfo['isbn'][$i] = $row[0];
$bookInfo['title'][$i] = $row[1];
$bookInfo['author'][$i] = $row[2];
$bookInfo['condition'][$i] =$row[3];
$bookInfo['thumbnail'][$i] = $row[4];
$bookInfo['price'][$i] = $row[5];
$i++;
}//end while loop
The weird thing is when I ran the for loop, the output was always twice the index of the array. I have been testing with a query that returns three results so when the for loop ran, it would run six times with the following code.
for($i=0; $i < count($bookInfo); $i++)
I though maybe is was because I used $i in the while loop but it should be local. Either way, I changed the $i to $j and it still did the same thing. The only way I found to get it to work is by using the row count which I set earlier like so.
for($i=0; $i < $numRows; $i++)
Any ideas as to why this was happening?