Hi there...!
Right I'm working on a script that will check two different databases (running two different websites)
In the table of both databases their is always the same number, which is what I'm trying to check against.
So If in Database 1 the user called 0010 has the state Active & there is a user called 0010 in Database two, then there is a match. (I.e. the user called 0010 in database one is active and has a name 0010 in database two.
However, If the user called 0010 in database one is not Active & there is a user called 0010 in database two, then I need to be alerted of this fact so I can delete the user 0010 in database two!
Are you confused as I am yet?
😕 :glare:
What I'm trying to do is, if the user of web site 1 (Database1) is NOT ACTIVE and has an account on web site two (database2) then I need telling when I run the script...
Upon running the script, it tells me that I need to delete user 0010 on database two, because they are no longer ACTIVE on database one!
This is what I've put together so far, but I'm lost! :bemused:
DATABASE ONE
<?php
$dbhost = "localhost";
$dbuname = "*****";
$dbpass = "*****";
$dbname = "*****";
$prefix = "****";
$user_prefix = "*****";
$dbtype = "MySQL";
$sitekey = "*****";
$connect=mysql_connect($dbhost,$dbname,$dbpass) or die("Could not connect.");
mysql_select_db($dbuname) or die("Could not select database.");
// get data from table
$result=mysql_query("SELECT d2,d4,d5,d8,d9,d18 FROM drivers WHERE d21 = 'Active' ORDER BY d18 ASC");
// debug statement
print "number of rows returned: " . mysql_num_rows($result) . "<br>";
echo "<table border='1' color='000000' cellpadding='0' cellspacing='0' bordercolor='#000080'>";
echo "<tr><th>MESSAGE</th><th>CONTACT</th><th>DATE / TIME</th></tr>";
while($row=mysql_fetch_array($result)) {
echo "<tr><td>";
$alec1 = $row['d18'];
echo "$alec1";
echo "</td><td>";
include("CheckDotIN.php");
echo "<br>";
echo "</td></tr>";
}
echo "</table>";
die();
?>
This is the code of CheckDotIN.php which is called in the loop everytime...
DATABASE TWO
<?php
$dbhost = "localhost";
$dbuname = "*****";
$dbpass = "****";
$dbname = "****";
$prefix = "****";
$user_prefix = "****";
$dbtype = "MySQL";
$sitekey = "****";
// Line 10
$connect=mysql_connect($dbhost,$dbname,$dbpass) or die("Could not connect.");
mysql_select_db($dbuname) or die("Could not select database.");
global $alec1;
// Line 18
// get data from table
$result=mysql_query("SELECT name FROM nuke_links_links WHERE sid = '0' ORDER BY name ASC");
while($row=mysql_fetch_array($result)) {
if ($row['name'] == "$alec1") {
//$alec = $row['name'];
echo " OK 1 ";
}
echo " OK 2 "; return;
}
//return;
?>
I know the formatting is a bit out, I'll fix that later!
Upon running the script, it seems to hang in this endless loop with no output at all.
Is there an easy way to check for this sort of stuff?
More Tea on offer if you can help me crack this one!!!! :rolleyes: :p 😃 🙂