문제

I'm getting this error:

'( ! ) Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\or2LAST\admin\adminData.php on line 5`

the code for this error (line 5):

$admin['push']=array(
        1=>"yes",
        2=>"no"

);

i tried to use "1" & "2" for the key but it didn't solve the problem.

where is the problem and why this error occurred?

도움이 되었습니까?

해결책 2

You need to declace $admin to an array first

like

$admin=array();

then try

$admin['push']=array(
    1=>"yes",
    2=>"no"

);

다른 팁

The problem is with $admin. You need to declare it as an array before using it:

$admin = array();

Whatever it is now, it's not an array. Possibly on a previous line you're overwriting it with some new (scalar) value instead of appending to it.

Your problem is probably with variable $admin, following should work just fine (assuming $admin is not previously declared).

$admin = array(); //<--!!
$admin['push']=array(
    1=>"yes",
    2=>"no"

);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top