>$MYSQLDB = mysql_connect("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("SLVProspectsTest");
$inEmail = trim($_POST["EmailAddress"]);
$query = "SELECT EmailAddress, UsrHash, AddressID FROM tblAddresses WHERE EmailAddress = '$inEmail'";
// run the query
$qryResult = mysql_query($query);
$qryNumRows = mysql_num_rows($qryResult);
// Add Auditing information to DB
$query = "INSERT INTO tblWebLogons (EmailAddress,DateLogon,Action) VALUES('$inEmail','$dtStamp','Successful Logon')";
// run the query
$qryResult = mysql_query($query);
mysql_close($MYSQLDB);
The situation is that I have two databases on the account:
SLVProspectsTest
SLVProspects
Test being naturally my test data set and the other being the live data. So while I'm typing away today I see that the listed code is SELECTing from SLVProspects and INSERTing into SLVProspectsTest, not a good thing!
Key Info: The two databases have the same username and password.
Naturally my goal is to have PHP and MySQL use the database in the mysql_select_db() call and only that database. Any help and insight is greatly appreciated.