I have this code
$query = "SELECT `subscriberid`,`data` FROM `****table_name*****`"
. "WHERE `subscriberid` IN (123,456,789,101)";
$result = $cxn->query($query);
$Points = array();
while ($row = $result->fetch_assoc()) {
$Points[$row['subscriberid']] = $row['data'];
}
I want the keys for $Points to be the subscriberid, but when I print out $Points I keep getting default keys 0-3 and I can't see any reason for this to be happening.
$Pointsisn't declared somewhere else? ie; it's a unique variable? Also, you could try an alias on the field:"SELECT subscriberid AS sid, data FROM...then use$row['sid']var_dump($Points)please, and avar_dump($row)in between the while loop please.while...loop inif ($result = $cxn->query($query)) {and}instead of just$result = $cxn->query($query);