PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$message = "
Clan Name : $clan_name
Clan Tag : $clan_tag
Clan Status : $clan_status
Honor : $clan_honor
Ladder Name : $ladder_name
Clan Rank : $clan_rank
Clan Points : $clan_points
Clan Win % : $clan_winpercent %
Clan Wins/Losses : $clan_wins / $clan_losses
Clan Streak : $clan_streak
Clan Started on $clan_regdate
url=www.aowars.com/modules.php?name=League&file=join_clan&op=accept&lid=$current_ladder&sid=$sending_user&pid=$recieving_playerid&cid=$clan_id]<< ACCEPT >>/url]
url=www.aowars.com/modules.php?name=League&file=join_clan&op=reject&lid=$current_ladder&sid=$sending_user&pid=$recieving_playerid&cid=$clan_id]<< REJECT >>/url] ";
// Begin sending the PM.
$pm_subject = "Clan Invite from $clan_tag";
$privmsgs_date = time();
$recieving_user_profile = sql_query("SELECT user_id, username FROM ".$prefix."_users WHERE user_id = $recieving_user");
list($user_id, $username) = sql_fetch_row($recieving_user_profile);
$message = "$message";
$subject = "Clan Invite from $clan_tag";
if(empty($message) || empty($subject)) {
return;
}
$bbcode_uid = make_bbcode_uid();
$privmsg_message = prepare_message($message, 1, 1, 1, $bbcode_uid);
$sql = "INSERT INTO nuke_bbprivmsgs (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date ) VALUES ('1', '".$subject."', '$sending_user', '$recieving_user', ".$privmsgs_date.")";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
echo "Could not insert private message sent info";
}
$privmsg_sent_id = $db->sql_nextid();
$privmsgs_text = $message;
$sql = "INSERT INTO nuke_bbprivmsgs_text (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) VALUES ('".$privmsg_sent_id."', '".$bbcode_uid."', '".$privmsg_message."')";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
echo "Could not insert private message sent text";
}
$sql = "UPDATE nuke_users
SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = '" . time() . "'
WHERE user_id = '$recieving_user'";
if ( !($result = $db->sql_query($sql)) )
{
echo "Could not update users table";
}
See how the message is made above the queries? Well I can't think of ANY way to get the PM id inside the message. Can you guys think of a way. I am doing this so that after a player accepts or rejects an invite, it deletes the PM.
$sql = "INSERT INTO ".$prefix."_bbprivmsgs (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date ) VALUES ('1', '".$subject."', '$sending_user', '$recieving_user', ".$privmsgs_date.")";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
echo "Could not insert private message sent info";
}
$lastid = mysql_insert_id($sql);
All I am trying to do is get the last insert ID. This isn't working for some reason. (I am using phpNuke. If I change !$db->sql_query to !$db->mysql_query I get an error.)