I am getting this PHP error, what does it mean?
Notice: Undefined offset: 0 in
C:\\xampp\\htdocs\\mywebsite\\reddit_vote_tut\\src\\votes.php on line 41
I encountered this as well and the solution is simple, dont hardcode the array index position in your code.
Instead of
$data[0]['somekey'] do
foreach($data as $data_item)
{
echo $data_item['somekey'];
}
If there is an array or more you can perform your desired action inside the loop, but if it's undefined it will not bring an error. you can also add other checks on top of that.
You could also add a variable and increment it in a for in loop to limit your looping if you want only the first positions or something.