Jump to content

perplexia

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

perplexia's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It works! jcbones and DavidAM THANK YOU! This was the solution, and DavidAM, I should have seen it in your earlier post. Thanks for seeing through the static and steering the conversation in the right direction. You guys are the best! Thanks to everyone who made an honest effort to help get this issue resolved.
  2. Ah, now I think we're getting somewhere with this. Thanks! Thanks for the suggestion. I'll do that, but currently my first priority is to get this insert function to work
  3. It was a typo, and not intentional. Sometimes those things happen. Sorry.
  4. Yes, I think you're exactly right with that assessment. The problem has to do with the connection, not the variables. I have verified that there is a connection, because I have another php file that selects all the data and echos it, and it works fine. I don't understand why the connection is lost whenever I try to insert. I got rid of the variables and put the connection script in the file rather than use an include. So here's what I've got at this point ...and it still gives me a closed connection error. <html> <head> <title>insert</title> </head> <body> <?php //Specify the path to the database //Note: this is an absolute path $databaseLocation = "c:\\wamp\\www\\Jim_Langeveld\\Maintenance1.mdb"; //Dreate an instance of the ADO connection object $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); //Define connection string, specify database driver $connStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=$databaseLocation;"; //get the main menu and display it at the top of the page include('menu.html'); //insert the data $insert = "INSERT INTO tblPurchasesHeader (Vendor, InvoiceDate,Invoice,TotalAmount,TaxAmount) VALUES (".$_POST['vendor']."','".$_POST['date']."','".$_POST['invoice']."','".$_POST['total']."','".$_POST['total']."')"; //Insert the new data into the database $conn->Execute($insert); echo "The information has been submitted."; ?> </body> </html>
  5. I did a var_dump on $insert and I got: string 'INSERT INTO tblPurchasesHeader (Vendor, InvoiceDate,Invoice,TotalAmount,TaxAmount) VALUES (11','11','11','11','11')' (length=115) this is good, right? I'm using WAMP and win7, not windows Server. Could that be an issue?
  6. ...sorry, I think this is what you were looking for: $conn is defined in connect.php as $conn = new COM ("ADODB.Connection") or die("Cannot start ADO");
  7. makes sense to me. how do I check the connection? Thanks.
  8. yes, I am using this code presently, but I still get a "object closed" error.
  9. $insert = "INSERT INTO tblPurchasesHeader (Vendor, InvoiceDate,Invoice,TotalAmount,TaxAmount) VALUES (".$vendor."','".$date."','".$invoice."','".$total."','".$tax."')"; $conn->Execute($insert);
  10. yes, when I do that I get this error: Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> ADODB.Connection<br/><b>Description:</b> Operation is not allowed when the object is closed
  11. hmmm... all your replies make perfect sense to me, but it's still doesn't work for some reason. I don't get any error messages, but it doesn't insert the data into the DB. Maybe there's a problem with the database itself? could it have something to do with the format of the columns ie: number, text, date, currency? Here's my updated code: //declare variables $vendor = ($_POST['vendor']); $date = ($_POST['date']); $invoice = ($_POST['invoice']); $total = ($_POST['total']); $tax = ($_POST['tax']); //insert the data $insert = "INSERT INTO tblPurchasesHeader (Vendor,InvoiceDate,Invoice,TotalAmount,TaxAmount) VALUES ('$vendor','$date','$invoice','$total','$tax')"; if(mysql_query($insert)) { echo "your information was submitted"; } else { echo "your information was not submitted"; } Thanks again for all your help!
  12. I will - as soon as I can test it to see if it works.
  13. I guess it was just a habit. I don't know if it works - haven't tested it.
×
×
  • 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.