Jump to content

Recommended Posts

Posted

>$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.

Posted (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 by eisc0013

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...