Store more than 1 piece of information in a single variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ok, firstly here's my script...

<?php

$db_host = '*****';

$db_user = '*****';

$db_pass = '*****';

$db_name = '*****';

$db_name2 = '*****';

$time = time();

$conn = mysql_connect($db_host, $db_user, $db_pass);

mysql_select_db($db_name);

$query = "SELECT * FROM `clanmembers`";

$result = mysql_query($query) or die('Query failed. ' . mysql_error());

while ($row = mysql_fetch_array($result)){

$user_loginname = $row['user_loginname'];

}

mysql_close_db;

mysql_select_db($db_name2);

$query = "SELECT user_id FROM `e107_user` WHERE `user_loginname` = '$user_loginname'";

$result = mysql_query($query) or die('Query 2 failed. ' . mysql_error());

while ($row = mysql_fetch_array($result)){

$user_id = ($row['user_id']);

$query = 'INSERT INTO e107_private_msg VALUES (NULL, \'1\', \''.$user_id.'\', \''.$time.'\', \'0\', \'Clan War 2\', \'Clan War Arranged\', \'0\', \'0\', \'\', \'+rr+\', \'0\');';

$result = mysql_query($query) or die('Query 3 failed. ' . mysql_error());

}

?>


Now, the script's task is to select loginnames from one database1, compare them to database2, select the user_id associated with the loginnames in database2 and send a private message to each of those loginnames.

Just now, the script selects only the last loginname from database1 and then sends a private message to that 1 person.

I need it to select all the loginnames which currently there are 25. So what do I need to change for this to work?

Thanks in advance.

Paul

Arena Servers - Web Hosting
http://www.arenasmithster.co.uk

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux