Hello, this is a bit of a wierd one, so please bear with me. Here's the setup.
1. We've got two sites, hosted by two different Hosts, but both sites are owned by the same person. I'll call these Mother and Child.
2. Mother has been running for a while and has a MySQL area with 6 tables for various tasks. All scripts on mother access the tables via 'localhost'.
3. Child is a new site, but has a form in common with Mother.
4. We want to directly log data entered on both these forms on the one NEW table on Mother's host called DMA_Log. Both forms also have to generate an ID number by getting the next available number from another NEW table called DMA_ID and adding some text to the front of it.
5. Here is the code that performs this action:
// Connect to database
$db = mysql_connect("secure.host.com","user","pwd");
// PART ONE - Work out the next DMA ID code so it can be entered into the DB with the rest of the info//
mysql_select_db("emed",$db);
$IDtable = "DMAID";
$IDquery = "SELECT * FROM DMA_ID";
$DMA_CODE = mysql_query($IDquery) or die (mysql_error());
if($resultrow = mysql_fetch_array($DMA_CODE))
{
$number = $resultrow["NEXT_ID"];
}while($resultrow = mysql_fetch_array($DMA_CODE));
// Now assing the Next ID number and add the DMA part of it to the variable//
$NextID = 'DMA' . $number;
// Finally, increment the ID number ready for the next user//
$newNumber = $number + 1;
$updateID = "UPDATE `DMA_ID` SET `NEXT_ID`= '$newNumber';";
$results = mysql_query($updateID);
// END OF PART ONE - DMA CODE CREATED//
Now, the only changes that are made to this script between sites is that the Child site connects to "secure.host.com" and the Mother site connects to "localhost".
Now this is the weird part. The script works perfectly on the Child site. But when run on the Mother site it can simply not find the DMA_ID table.
I have substituted DMA_ID with another table that the Mother site uses and the error goes away.
Any Ideas why the external site can see the table but the local site cannot?
Thanks for any help
Aaron
1. We've got two sites, hosted by two different Hosts, but both sites are owned by the same person. I'll call these Mother and Child.
2. Mother has been running for a while and has a MySQL area with 6 tables for various tasks. All scripts on mother access the tables via 'localhost'.
3. Child is a new site, but has a form in common with Mother.
4. We want to directly log data entered on both these forms on the one NEW table on Mother's host called DMA_Log. Both forms also have to generate an ID number by getting the next available number from another NEW table called DMA_ID and adding some text to the front of it.
5. Here is the code that performs this action:
// Connect to database
$db = mysql_connect("secure.host.com","user","pwd");
// PART ONE - Work out the next DMA ID code so it can be entered into the DB with the rest of the info//
mysql_select_db("emed",$db);
$IDtable = "DMAID";
$IDquery = "SELECT * FROM DMA_ID";
$DMA_CODE = mysql_query($IDquery) or die (mysql_error());
if($resultrow = mysql_fetch_array($DMA_CODE))
{
$number = $resultrow["NEXT_ID"];
}while($resultrow = mysql_fetch_array($DMA_CODE));
// Now assing the Next ID number and add the DMA part of it to the variable//
$NextID = 'DMA' . $number;
// Finally, increment the ID number ready for the next user//
$newNumber = $number + 1;
$updateID = "UPDATE `DMA_ID` SET `NEXT_ID`= '$newNumber';";
$results = mysql_query($updateID);
// END OF PART ONE - DMA CODE CREATED//
Now, the only changes that are made to this script between sites is that the Child site connects to "secure.host.com" and the Mother site connects to "localhost".
Now this is the weird part. The script works perfectly on the Child site. But when run on the Mother site it can simply not find the DMA_ID table.
I have substituted DMA_ID with another table that the Mother site uses and the error goes away.
Any Ideas why the external site can see the table but the local site cannot?
Thanks for any help
Aaron