help in invite topic function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    help in invite topic function

    hello friends, i have made this topic invite function.. but i am only able to select only 1 username to send invite.. but i want my users to send invite to multiple users by seperating username with comas in txtboz..
    Code:
    if($action=="sendinvi"){
    echo "<p align=\"left\">";
    $pmtou = $_POST["usn"];
    $who = getuid_nick($pmtou);
    $whonick = getnick_uid($who);
    addonline(getuid_sid($sid),"inviting users to topic","");
    $byuid = getuid_sid($sid);
    $tm = time();
    $pmtext = "txt";
    $dm = mysql_fetch_array(mysql_query("SELECT id FROM hfjgn_users WHERE name='".$unm."'"));
    $res = mysql_query("INSERT INTO hfjgn_private SET text='".$pmtext."', byuid='".$byuid."', touid='".$who."', timesent='".$tm."'");
    
    
    echo "<img src=\"images/ok.gif\" alt=\"O\"/>";
    echo "PM was sent successfully to $whonick<br/><br/>";
    echo parsepm($pmtext, $sid);
    echo "<br/><br/><a href=\"121inbox121.php?action=disp\">Back to MailBox</a><br/>";

    #2
    PHP Code:
    if($action=="sendinvi"){
    echo 
    "<p align=\"left\">";
    $usrs explode(",",$_POST['usn']);
    $insert = array();
    addonline(getuid_sid($sid),"inviting users to topic","");
    $byuid getuid_sid($sid);
    $tm time();
    $pmtext "txt";

    foreach(
    $usrs as $pmtou)
     {
     
    $who getuid_nick($pmtou);
     
    $insert[] = "('".$pmtext."'"'".$byuid."','".$who."','".$tm."')";
     }



    $res = mysql_query("INSERT INTO hfjgn_private (text,byuid,touid,timesentVALUES ".implode(",",$insert));


    echo "
    <img src=\"images/ok.gif\" alt=\"O\"/>";
    echo 
    "PM was sent successfully to ".implode(", ",$usrs)."<br/><br/>";
    echo 
    parsepm($pmtext$sid);

    echo 
    "<br/><br/><a href=\"121inbox121.php?action=disp\">Back to MailBox</a><br/>"
    try something like that

    Comment


      #3
      thnx to reply mate.. it shows that it sent msg to all users what we wrote but only sending to 1st username still.

      Comment


        #4
        since i dont use wap sources i cant test any of the code, the code is quite simple really , change

        Code:
        $res = mysql_query("INSERT INTO hfjgn_private (text,byuid,touid,timesent) VALUES ".implode(",",$insert));
        to

        Code:
        print("INSERT INTO hfjgn_private (text,byuid,touid,timesent) VALUES ".implode(",",$insert));
        In the code i gave and try it again, it should print out the sql statement, put that in this thread so i can have a look at wat the loop is producing, it should work as i use a similar method on another site for mass messaging

        Comment


          #5
          when i made changes as you said then INSERT INTO hfjgn_private (text,byuid,touid,timesent) VALUES ('txt', '2','322','1264102501'),('txt', '2','','1264102501'),('txt', '2','','1264102501')OPM was sent successfully to sterla , w0lverln3 , raghavan

          Comment


            #6
            that means the touid isnt being set for the last 2 messages, that value is controlled by $who which in turn gets its value from getuid_nick($pmtou);.

            I imagine either you are entering an invalid username or there is a problem with your getuid_nick function (or that function isnt doing what you think it does)

            Comment


              #7
              well 322 is the uid.. function getuid is ok as it selected ids.. but still not in this format 1 , 2 , 3 , 4 etc

              Comment


                #8
                how do you know getuid function has gotten the id's, 322 is ONE of the id's, the id for sterla to be exact, it is not retrieving the id for the other two, and qute simply it looks like you are putting spaces after or before each comma which obviously means that the 2nd and 3rd user you send it too dont exist with the usernames provided as you have put spaces in there, put the mysql query back to how it was and in my code change

                Code:
                 $who = getuid_nick($pmtou);
                too
                Code:
                 $who = getuid_nick(trim($pmtou));

                Comment

                Working...
                X