Well, its recognizing the values from $name but this is what this script is doing exactly with the way it is now.
foreach($matches[1] as $key => $value) { //3
$name = $matches[1][$key];
$ip = $matches[3][$key];
$id = $matches[2][$key];
echo "<br>";
//echo "\n<br>" . $playername . " | " . $playerip . " | " . $playerid . "</br>\n" ;
/*$comparename = mysql_query("SELECT Player, IP, UniqueID FROM " . $xoopsDB->prefix('PlayersTOSERV') .
" WHERE Player = '$addname' AND IP = '$addip' AND UniqueID = '$addid'");
$mysql_num = mysql_num_rows($comparename);
if ($mysql_num == 0) { //4
$sql = "INSERT INTO ".$xoopsDB->prefix('PlayersTOSERV');
$sql .= " (id, Player, IP, UniqueID ) VALUES ";
$sql .= " ( '', '$addname', '$addip' , '$addid')";
$result = $xoopsDB->queryF($sql) or die('SQL Error: ' . mysql_error());
}
*/
global $xoopsDB;
$sql1 ="SELECT Player, IP, UniqueID FROM " . $xoopsDB->prefix('PlayersTOSERV') .
" ";
$result = $xoopsDB->query($sql1) or die('SQL Error: ' . mysql_error());
while ($v = mysql_fetch_row($result)) {
$checkname = $v['0'];
}
if ($name == $checkname) {
echo "<br>Match " . $name . " In DB<br>";
}
if ($name !== $checkname) {
echo "<br>No Match " . $name . " Not In DB<br>";
}
}}
Lets say $name returns one, two, three, four, five
Lets say my table field Player has one, two, three in the db.
This script outputs this
No Match one Not in DB
No Match two Not in DB
No Match four Not in DB
No Match five Not in DB
Match three IN DB
if I change from == to = and !== to !=
I just see ($name matched to $checkname) from the last row Match three in DB repeated
I know I the compared operator is wrong or the compared variables are wrong. I know the loop is also an issue.
What My goal is, compare all $names in the foreach loop to the db Player fields, then list the following
If (the values of $name match a db record) {
echo Match $name)
}
if (the values of $name dont match any db record) {
echo "no match for $name";
}
I used to be better at this some years ago.. sigh...
Cheers,
Bimmer