Coding Help Please

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

    Coding Help Please

    this has been stressing me for days lol could anyone please tell me what i've done wrong? i'm trying to get a page to pm all members, the code im using follows...


    Code:
    <?php 
    header("Cache-Control: no-cache, must-revalidate");
    	include("config.inc.php");
    header("Pragma: no-cache");
    header("Content-type: text/vnd.wap.wml"); 
    echo "<?xml version=\"1.0\"?>"; 
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; 
    echo "<wml>"; 
    $sqlthing = mysql_query("SELECT * FROM members WHERE username='$username'");
       $owner=(mysql_result($sqlthing,0,"owner"));
       $pmname=(mysql_result($sqlthing,0,"pmname"));
       $buddyname=(mysql_result($sqlthing,0,"buddyname"));
    
    echo "<card id=\"card1\" title=\"$pmname Sent\">"; 
    echo "<p align=\"center\">";
    
    $Connect = mysql_connect("$server","$user","$pass");
    mysql_select_db("$dbname");
    $result=mysql_query("select * from members where username='$username' and session='$session'");
    $number_of_rows = mysql_num_rows($result);
    if ($number_of_rows>0)
    {
    	include("check.inc.php");
    }
    if ($ok>0)
    {
    	include("online.inc.php");
    
    
    $date_sent = date('Y-m-d H:i:s');
    
    	$from_username=$username;
    	$has_it_been_read = "no";
        $pos=1;
    
    $gbvalues="$pm_message";
    	include("smilies.inc.php");
    
    $max_results = 3000; 
    $result9 = mysql_query("SELECT * FROM members ORDER by id asc LIMIT 0, $max_results"); 
     $username9=(mysql_result($result9,0,"username"));
    
    
    
    
    $date_sent = date('Y-m-d H:i:s');
    	$sql = "INSERT INTO privatemessage3 (to_username, from_username, date_sent, has_it_been_read, pm_message, spamfree) VALUES ('$username9','$from_username','$date_sent','no','$pm_message','$pos')";
    $result = mysql_query($sql);
    
    
    
    
    
    
    
    
    
    echo " PM Sent to All Staff<br/>";
    echo "<a title=\"Enter\" href=\"pm.php?username=$username&amp;session=$session\">Continue</a>";
    
    
    
            
            
            }
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    ?>
    My problem is it only sends to one person and i cant work out how to get it to select every member, any help would be appreciated

    Many thanks
    Jamie
    :p:p:p

    #2
    '$username9'


    You need to array this as this only will lookup 1 per send.
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      thanks sub but thats the bit i dont see how to do, i dont understand why its only returning one name
      :p:p:p

      Comment


        #4
        Code:
        $result = mysql_query("SELECT * FROM members ORDER by id"); 
        
        if(mysql_num_rows($result) > 0) 
        { 
        $username9 = 0; 
        while ($row = mysql_fetch_array ($result, mysql_ASSOC)) 
        {
        $username9 = $row['to_username'] . ', ';
        $date_sent = date('Y-m-d H:i:s');
        	$sql = "INSERT INTO privatemessage3 (to_username, from_username, date_sent, has_it_been_read, pm_message, spamfree) VALUES ('$username9','$from_username','$date_sent','no','$pm_message','$pos')";
        $result = mysql_query($sql);
        }
        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
        Visit: WapMasterz Coming Back Soon!
        _______
        SCRIPTS FOR SALE BY SUBZERO
        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #5
          that just gives me a white page sub mate
          :p:p:p

          Comment


            #6
            . ', ';

            take out

            then place ; only

            My error lol
            Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
            Visit: WapMasterz Coming Back Soon!
            _______
            SCRIPTS FOR SALE BY SUBZERO
            Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
            FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
            _______
            Info & Tips
            php.net
            w3schools.com

            Comment


              #7
              still the same mate, white page, validation says - end of document in prolog
              :p:p:p

              Comment


                #8
                Code:
                $result = mysql_query("SELECT * FROM members ORDER by id"); 
                if(mysql_num_rows($result) > 0) 
                { 
                $username9 = 0; 
                while ($row = mysql_fetch_array ($result, mysql_ASSOC)) 
                {
                $username9 = $row['to_username'] . ', ';
                $date_sent = date('Y-m-d H:i:s');
                	$sql = "INSERT INTO privatemessage3 (to_username, from_username, date_sent, has_it_been_read, pm_message, spamfree) VALUES ('$username9','$from_username','$date_sent','no','$pm_message','$pos')";
                $count++; 
                } 
                echo "myResult=$count Emails Sent. Done."; 
                }else{ 
                echo "myResult=Email Submissions Failed."; 
                }
                Or

                Code:
                $result = mysql_query("SELECT * FROM members ORDER by id"); 
                if(mysql_num_rows($result) > 0) 
                { 
                $count = 0;
                while ($row = mysql_fetch_array ($result, mysql_ASSOC)) 
                {
                $username9 = $row['to_username'] . ', ';
                $date_sent = date('Y-m-d H:i:s');
                	$sql = "INSERT INTO privatemessage3 (to_username, from_username, date_sent, has_it_been_read, pm_message, spamfree) VALUES ('$username9','$from_username','$date_sent','no','$pm_message','$pos')";
                $count++; 
                } 
                echo "myResult=$count Emails Sent. Done."; 
                }else{ 
                echo "myResult=Email Submissions Failed."; 
                }
                Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                Visit: WapMasterz Coming Back Soon!
                _______
                SCRIPTS FOR SALE BY SUBZERO
                Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                _______
                Info & Tips
                php.net
                w3schools.com

                Comment


                  #9
                  myResult=0 Emails Sent. Done. PM Sent to All Staff
                  Continue

                  but nothing sent to anyone now mate

                  the coding youre trying mate looks more like php5, its a php4 scotspaul script im editing
                  :p:p:p

                  Comment


                    #10
                    oh ok i will think of a good plan then
                    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                    Visit: WapMasterz Coming Back Soon!
                    _______
                    SCRIPTS FOR SALE BY SUBZERO
                    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                    _______
                    Info & Tips
                    php.net
                    w3schools.com

                    Comment


                      #11
                      cheers sub mate
                      :p:p:p

                      Comment


                        #12
                        Give this a shot

                        Code:
                        $query="SELECT * FROM members ORDER by id";
                        $result=mysql_query($query);
                        $num=mysql_num_rows($result);
                        
                         $i=0;
                                while ($i < $num) 
                                {
                        $username9=mysql_result($result,$i,"to_username");
                        
                        $date_sent = date('Y-m-d H:i:s');
                        $sql = "INSERT INTO privatemessage3 (to_username, from_username, date_sent, has_it_been_read, pm_message, spamfree) VALUES ('$username9','$from_username','$date_sent','no','$pm_message','$pos')";
                        $result = mysql_query($sql);
                        
                        $i++;
                                                        
                                }
                        }
                        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                        Visit: WapMasterz Coming Back Soon!
                        _______
                        SCRIPTS FOR SALE BY SUBZERO
                        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                        _______
                        Info & Tips
                        php.net
                        w3schools.com

                        Comment


                          #13
                          Sorted it thanks sub, Cheers for the help. the following works fine

                          Code:
                          $result9 = mysql_query("SELECT * FROM members ORDER by id asc"); 
                          if(mysql_num_rows($result9) > 0) 
                          { 
                          $count = 0;
                          while ($row = mysql_fetch_array ($result9)) 
                          {
                          $username9 = $row['username'];
                          $date_sent = date('Y-m-d H:i:s');
                          	$sql = "INSERT INTO privatemessage3 (to_username, from_username, date_sent, has_it_been_read, pm_message, spamfree) VALUES ('$username9','$from_username','$date_sent','no','$pm_message','$pos')";
                          $result = mysql_query($sql);
                          
                          
                          
                          }}
                          :p:p:p

                          Comment


                            #14
                            Always glad to help.
                            Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                            Visit: WapMasterz Coming Back Soon!
                            _______
                            SCRIPTS FOR SALE BY SUBZERO
                            Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                            FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                            _______
                            Info & Tips
                            php.net
                            w3schools.com

                            Comment


                              #15
                              youre a star mate, its the array bit i missed, cheers dude
                              :p:p:p

                              Comment

                              Working...
                              X