注意:数组字符串转换在 [英] Notice: Array to string conversion in

查看:126
本文介绍了注意:数组字符串转换在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从数据库中的值,并使用SELECT它显示给用户。在线36阵列字符串转换中(路径):不过,我不断收到这个 - 通知。
我认为@mysql_fetch_assoc();想解决这个问题,但我仍然得到通知。这是code的一部分,在那里我得到的错误:

I'm trying to select a value from a database and display it to the user using SELECT. However I keep getting this- Notice: Array to string conversion in (pathname) on line 36. I thought that the @mysql_fetch_assoc(); would fix this but I still get the notice. This is the part of the code where I'm getting the error:

  {
  $loggedin = 1;

  $get = @mysql_query("SELECT money FROM players WHERE username = 
 '$_SESSION[username]'");
  $money = @mysql_fetch_assoc($get);

  echo '<p id= "status">'.$_SESSION['username'].'<br>
  Money: '.$money.'.
  </p>';
  }

我是什么做错了吗?我是pretty新的PHP。

What am I doing wrong? I'm pretty new to PHP.

推荐答案

的问题是,$钱是一个数组,你像一个字符串或可以很容易地转换成字符串变量对待它。你应该这样说:

The problem is that $money is an array and you are treating it like a string or a variable which can be easily converted to string. You should say something like:

 '.... Money:'.$money['money']

这篇关于注意:数组字符串转换在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆