I have a question for you guys. I've got an sql statement here that doesn't seem to populate the database correctly. What am I doing wrong?
$time=time();
$time = $time+1;
$playername = $player[name]; //<== VARIABLE FROM SERVER QUERY, LISTS EACH PLAYER IN AN ARRAY.
$hostname = $data[hostname];
$playerscore = $player[score];
$playerdeaths = $player[deaths];
$playerskill = $player[skill];
$playergoal = $player[goal];
$playerhonor = $player[honor];
$playerleader = $player[leader];
$playerping = $player[ping];
$playerteam = $player[team];
$playerstats = $player[stats];
$playertime = $player[time];
$playerskin = $player[skin];
$playerhash = $player[hash];
$playerpid = $player[pid];
$gameserver_ip = $data[ip];
$gameserver_port = $data[port];
$q = mysql_query("SELECT * FROM ".$xoopsDB->prefix("bf2query_players")." WHERE p_name='$playername'");
if (mysql_num_rows($q)==0) {
// if not, create dummy entry
mysql_query("INSERT INTO ".$xoopsDB->prefix("bf2query_players")." SET p_time='$playertime', p_s_ip='$gameserver_ip', p_name='$playername', p_s_name='$hostname', p_s_port='$gameserver_port', p_score='$playerscore', p_deaths='$playerdeaths', p_skill='$playerskill', p_goal='$playergoal', p_honor='$playerhonor', p_leader='$playerleader', p_ping='$playerping', p_team='$playerteam', p_stats='$playerstats', p_skin='$playerskin', p_hash='$playerhash', p_pid='$playerpid', p_s_time='$time'");
echo "$player[name]
";//USE THIS TO TEST FOR ERRORS
}else{
mysql_query("UPDATE ".$xoopsDB->prefix("bf2query_player_info")." SET p_time='$playertime', p_s_ip='$gameserver_ip', p_name='$playername', p_s_name='$hostname', p_s_port='$gameserver_port', p_score='$playerscore', p_deaths='$playerdeaths', p_skill='$playerskill', p_goal='$playergoal', p_honor='$playerhonor', p_leader='$playerleader', p_ping='$playerping', p_team='$playerteam', p_stats='$playerstats', p_skin='$playerskin', p_hash='$playerhash', p_pid='$playerpid', p_s_time='$time' WHERE p_name='$playername'");
}
And as always, many many thanks to all that help!