$data = mysql_query(" SELECT * FROM user_pokemon_db WHERE user_id = '".$id."' ");
while($rows = mysql_fetch_array($data))
{
$pkmn_id = $rows['pkmn_id'];
$path = mysql_query(" SELECT path FROM pokemons WHERE pk_id = '".$pkmn_id."' ");
$poke = mysql_result($path, 0, "path");
echo $poke;
echo "<br />";
$level = $rows['level'];
echo $level;
echo "<br />";
$exp = $rows['exp'];
echo $exp;
这是我的PHP代码,它显示错误:
第18行C:\wamp\www\slots.php
中的数组到字符串转换
Line 18 is this:while($rows = mysql_fetch_array($data))
我还没有使用任何阵列?但这曾经奏效!但突然间这个错误开始了?
答案 0 :(得分:3)
检查$id
是否为array
,似乎会导致此问题。
$id = "'" . implode("', '", $id) . "'";
$data = mysql_query(" SELECT * FROM user_pokemon_db WHERE user_id IN ({$id}) ");