Jump to content

Repetative Access To MySql Script


praeclarus

Recommended Posts

Let Me Reveal My code first:

 

<?php include \'header.php\';

print "Deleting mrp tables now...............";

$sql = mysql_query("DROP TABLE mrp,supplier,reciept");

#

# Table structure for table \'mrp\'

#

print "Creating mrp tables now...............";

mysql_query("CREATE TABLE mrp (

 Supplier varchar(7) default NULL,

 ProductClass varchar(4) default NULL,

 StockCode varchar(30) default NULL,

 Description varchar(30) default NULL,

 LongDesc varchar(30) default NULL,

 WeekNumber varchar(255) default NULL,

 SumOfSuggestedQty decimal(10,0) default NULL,

 WarehouseToUse char(2) default NULL

) TYPE=MyISAM");







#

# Table structure for table \'reciept\'

#



mysql_query("CREATE TABLE reciept (

 Supplier varchar(7) default NULL,

 SupplierName varchar(30) default NULL,

 StockCode varchar(30) default NULL,

 LastReceiptDate datetime default NULL,

 LastReceiptQty decimal(10,0) default NULL

) TYPE=MyISAM");







#

# Table structure for table \'supplier\'

#



mysql_query("CREATE TABLE supplier (

 Supplier varchar(7) default NULL,

 SupplierName varchar(30) default NULL,

 SupAddr1 varchar(40) default NULL,

 SupAddr2 varchar(40) default NULL,

 SupAddr3 varchar(40) default NULL,

 Telephone varchar(20) default NULL,

 Fax varchar(20) default NULL,

 Contact varchar(40) default NULL,

 Email varchar(50) default NULL,

 FaxContact varchar(40) default NULL

) TYPE=MyISAM");



$db1 = "D:webrelease.mdb";



   

$connection = new COM("ADODB.Connection");

$connection->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db1");



$sqla = "SELECT   * FROM supplier";



$rsa = $conn->Execute($sql);



$sqlb = "SELECT   * FROM reciept";



$rsb = $conn->Execute($sql);



$sqlc = "SELECT   * FROM mrp";



$rsc = $conn->Execute($sql);





while (!$rsa->EOF):

$suppliera = $rs->Fields[\'Supplier\'];

$productclassa = $rs->Fields[\'ProductClass\'];

$StockCodea = $rs->Fields[\'StockCode\'];

$Descriptiona = $rs->Fields[\'Description\'];

$LongDesca = $rs->Fields[\'LongDesc\'];

$WeekNumbera = $rs->Fields[\'WeekNumber\'];

$SumOfSuggestedQtya = $rs->Fields[\'SumOfSuggestedQty\'];

$WarehouseToUsea = $rs->Fields[\'WarehouseToUse\'];



print "Updating MRP table now...............";

mysql_query("INSERT INTO sidler_supply_line.mrp(Supplier, ProductClass, StockCode, Description, LongDesc, WeekNumber, SumOfSuggestedQty, WarehouseToUse)

VALUES(\'$suppliera\', \'$productclassa\',\'$StockCodea\', \'$Descriptiona\', \'$LongDesca\', \'$WeekNumbera\', \'$SumOfSuggestedQtya\', \'$WarehouseToUsea\'") or die (mysql_error());

$rsa->MoveNext()

endwhile

$rsa->Close();

?>

 

What im trying to do is dump the mysql tables which does work and then recreate the same tables with information within an access database that is pulling live info from a transoft odbc. The reason for this is that my customer does not want live info going directly into the website without being reviewed first. When the information has been review I want to provide a Button or link to a php script that will automatically update the tables for them.

 

Anyone have any good ideas for this. I know the script is not complete but im running into parse errors that I cant see why they are happening.

 

Thanks in advance for any help you can give me.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.