S
S
Schoolboy.2015-09-27 15:38:52
PHP
Schoolboy., 2015-09-27 15:38:52

How to write data to an array from MySQL?

[146] $data=$pdo->prepare("SELECT phone FROM `users` WHERE `phone`=?");
[147] $data->execute(array($wildlogin));
[148]	
[149] $data = $data->fetchAll();
[150]	
[151] if ($data[4] == $wildpassword or $data[5] == $wildpassword) {
[152] return $data;
[153] }

Gives out:
Notice: Undefined offset: 4 in C:\xampp\htdocs\lib\functions.php on line 151

Notice: Undefined offset: 5 in C:\xampp\htdocs\lib\functions.php on line 151

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Defman21, 2015-09-27
@Defman21

It is written to you that $data has no 4 and 5 indexes. Do a var_dump and see what you have in the array.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question