PHP - Echo 'Array' error

匿名 (未验证) 提交于 2019-12-03 02:38:01

问题:

sorry for being vague but I have a PHP script which extracts data from a database and displays it, however instead of outputting the contents of the database it outputs 'Array' the number of times their are results.

(Couldn't get the to work again, script uploaded here), the script's output is also here.) Thanks :-)

回答1:

$row is an array, in contains all record fields. Use

echo $rows['unique_id'];

instead.

And don't use mysql extension



回答2:

Use print_r($array); or var_dump($array); to see



回答3:

Have you tried printr or var_dump?

You need to specify the column or value in the array to echo.

echo $rows[unique_id];


回答4:

As the name implies, mysql_fetch_array() returns an array. You probably want:

 echo $rows['unique_id'];


转载请标明出处:PHP - Echo 'Array' error
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!