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...
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
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&session=$session\">Continue</a>"; } echo "</p>"; echo "</card>"; echo "</wml>"; ?>
Many thanks
Jamie
Comment