Ok, so let's assume i have a database like this
//table name is: exampleTable
_________________________
| ID | NAME | EXAMPLEDATA |
|----|------|-------------|
| 0 | TOD | a123 |
| 1 | JEF | 142b |
| 2 | MAX | c412 |
| 3 | TOD | 124d |
| 4 | TOD | e634 |
| 5 | MAX | 233f |
| 6 | MAX | g444 |
|____|______|_____________|
How would i get all the values of EXAMPLEDATE
with a query like this ( using prepared statements )
SELECT EXAMPLEDATA FROM exampleTable WHERE NAME = 'TOD'
and store results into an array so i can access it like this :
$todArray[0] // equals a123
$todArray[1] // equals 124d
$todArray[2] // equals e634
The only way i know how to use prepared statements to get results is to use bind_result
but that doesn't take the result(s) and put it in an array like what i showed above.
So here is what I've tried but it failed to work
$TOD = "TOD";
$dbCON = new mysqli(blah, blah, blah, blah);
$getData = $dbCON->prepare("SELECT `EXAMPLEDATA` FROM `exampleTable` WHERE `NAME`=?");
$getData->bind_param("s", $NAMEVAR);
$NAMEVAR = $TOD;
$getData->execute();
$getData->bind_result($todArray);
$getData->fetch();
$getData->close();
Any help would be appreciated thanks :)