Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
319 views
in Technique[技术] by (71.8m points)

php - Invalid arguments passed join()

So I made this script that should fetch an array using mysqli_fetch_array and mysqli_query it all works fine, and no error shows up, but then after I change something, using another function, for example, If I change the mood, nickname or whatever, it shows an error

Warning: join(): Invalid arguments passed in Main.php on line 526

Iv'e been trying to fix this using a while loop and the same thing happens

$info = mysqli_fetch_array(mysqli_query($con, "SELECT id, nickname, mood, credits, colour, curhead, curface, curneck, curbody, curhands, curfeet, curflag, curphoto, rank * 146 FROM `sync_users` WHERE id='" . mysqli_real_escape_string($con, $raw[5]) . "';"), MYSQLI_ASSOC);
$client->sendPacket("%xt%gp%-1%" . join("|", $info) . "%");
print str_replace('Array', '', print_r($info, true));

I tried asking a few other friends who knew php well and they were unable to give me a solution as well.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

One or more elements of the array isn't a string. Either cast the offending fields in the query, or pass all the fields through strval() first.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...