I am having trouble getting an sql request to work. Without giving more details than needed,
$db_query = mysql_query(" select years,avg,best,win,top10,champs from `profile` where PLAYERID = '$monkey_id'");
works fine. However,
$db_query = mysql_query(" select * from `profile` where PLAYERID = '$monkey_id'");
doesn't return any results. The only change is that I'm trying to pull all fields instead of just those few. I'm at a loss to explain this. I taught myself all this stuff, so it's always possible I'm doing something dumb.
Edit: Here's the rest of the surrounding code:
$db_query_inside = mysql_query(" select * from `profile` where PLAYERID = $monkey_id");
$db_query = mysql_fetch_array($db_query_inside);
$years_prev = $db_query['years'];
$avg_prev = $db_query['avg'];
$best_prev = $db_query['best'];
$win_prev = $db_query['win'];
$top10_prev = $db_query['top10'];
$champs_prev = $db_query['champs'];
Edit again: Still don't know开发者_高级运维 why it wouldn't work with *, but I just got what I needed done by listing the specific fields. It doesn't end up with any sort of error that can be gleaned from
die(mysql_error())
so I'm just giving up and working on stuff that reacts rationally.
Why not try:
$db_query = mysql_query(" select `profile` where PLAYERID = '$monkey_id'");
Let's do this, modify the following line to reflect below. See what the error says, if any. I tried it myself (your code) and it seems to work fine.
$db_query_inside = mysql_query(" select * from `profile` where PLAYERID = $monkey_id") or die(mysql_error());
精彩评论