Killahbyte
11-08-2006, 06:58 PM
Ok we have a team table that holds all our teams and stats. What i am trying to do is have a sql query that will update user table with the stats from team table. But the only thing updating is one column. I need both. Anyone care to help with this problem?
global $db;
$sql = $db->query_first("select * from " . TABLE_PREFIX . "userteam WHERE userteamid=$teamid AND WHERE title=$teamtitle");
if ($sql){
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET teamtitle = '$teamtile' WHERE $teamid=userteamid AND WHERE title=$teamtitle");
}else{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET teamtitle = 'NULL' WHERE userteamid=$teamid");
}
What is happening is the teamid in user table updates but the teamtitle does not. Where is my error?
KB
global $db;
$sql = $db->query_first("select * from " . TABLE_PREFIX . "userteam WHERE userteamid=$teamid AND WHERE title=$teamtitle");
if ($sql){
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET teamtitle = '$teamtile' WHERE $teamid=userteamid AND WHERE title=$teamtitle");
}else{
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET teamtitle = 'NULL' WHERE userteamid=$teamid");
}
What is happening is the teamid in user table updates but the teamtitle does not. Where is my error?
KB