eisc0013 Posted August 2, 2006 Posted August 2, 2006 >$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. Quote
eisc0013 Posted August 2, 2006 Author Posted August 2, 2006 (edited) Never mind, thanks to a handy grouping feature I missed the second record that was making it appear data was coming from the wrong database (when it was actually coming from the correct DB). Edited August 2, 2006 by eisc0013 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.