473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help connecting php to a MS Access database

8
Hello all,

I am new to php and I can't seem to get some code to insert information into a Access database. I am running Apache 2.2 server with php 5.1.2 and on a Windows XP SP2 platform. Here is the code I am attempting to get running, if someone is intrested in helping a new php person out.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $Fname = $_POST["name"];
  3. $Fphone = $_POST["phone"];
  4. $Fproblem = $_POST["problem"];
  5. $Fdate = date("m/d/Y");
  6. if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form
  7. ?>
  8.  
  9. <html>
  10. <head>
  11. <title>IT Issues</title>
  12. </head>
  13. <body bgcolor="#00FFFF" onLoad="self.focus();document.IssueAdd.name.focus()" >
  14. <h1 align="center">Tuthill Transport Technologies</h1>
  15. <hr>
  16. <h2><i><font size="5" face="Arial">IT Trouble Report</font></i></h2>
  17. <!-- Begin form code --> 
  18.  
  19. <tr>
  20. <td width="100%" valign="top">
  21.  <form name="IssueAdd" method="post" action="<?php echo $PHP_SELF;?>">
  22.     <font size="3" face="Arial"> Name: <input type="text" name="name" tabindex=1 maxlength="20"></font> 
  23.      <br>
  24.     <font size="3" face="Arial"> Phone: <input type="text" name="phone" tabindex=2 maxlength="5"></font> 
  25. </td>
  26. </tr>
  27.  
  28. <tr>
  29. <br>
  30. <td width="100%" valign="top"> <br></td>
  31. </tr>
  32.  
  33. <tr>
  34. <td width="100%" valign="top">
  35.     <font size="3" face="Arial">
  36.     <q>Please give a summary of the problem, and any cause that you may know of.</q>
  37.     </font> <br>    <textarea name="problem" tabindex=3 rows="10" cols="70"></textarea>
  38. </td>
  39. </tr>
  40.  
  41. <tr>
  42. <br>
  43. <td width="100%" valign="top"> <br></td>
  44. </tr>
  45.  
  46. <tr>
  47. <br>
  48. <td width="100%" valign="top">
  49.      <input type="submit" name="submit" tabindex=4 value="Submit Request">
  50. </td>
  51. </tr>
  52.  
  53. <tr>
  54. <br>
  55. <td width="100%" valign="top"> <br></td>
  56. </tr>
  57.  
  58. </form> 
  59. </body>
  60. </html>
  61. <?
  62. } else {
  63. echo "<b>Your request has been sent to the IT group as:</b><br/>";
  64. echo "<br />";
  65. echo "Contact name: ".$Fname." at ".$Fphone."<br />";
  66. echo "<br />";
  67. echo "To resolve: <br />";
  68. echo $Fproblem." <br />";
  69. echo "<br />";
  70. echo "Submission Date: ";
  71. //echo date("m/d/Y");
  72. echo $Fdate;
  73. echo "<br />";
  74. echo "Submission Time ";
  75. echo date("h:i:s");
  76. echo "<br />";
  77. echo "<br />";
  78. echo "<br />";
  79. echo "Thank You";
  80.  
  81. $db = 'C:\\xampp\\htdocs\\ITrequest\\PC_PROBLEMS.mdb';
  82. $conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
  83. //$con=odbc_connect("ITrequest","","") or exit('Cannot open with ODBC');
  84. $conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or exit('Cannot open with Jet.');
  85. //$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db") or exit('Cannot open with driver.');
  86. $sql = "INSERT INTO PROBLEMS(USER,phone,SUMMARY OF REPORT,date) VALUES('$Fuser','$Fphone','$Fproblem','$Fdate'])";
  87. $rs = $conn->Execute($sql);
  88.  
  89. }
  90. ?>
  91.  
As you can see I have made several attempts to connect with different drivers, but I have had no sucess with any.

Thank You
Oct 29 '07 #1
2 3602
code green
1,726 Expert 1GB
Can you break the problem down a little more.
I am not sure if you mean the connection is failing or the INSERT query.
I have used the COM class to connect to Access before so I know it generates error messages (albeit not very helpful).
What errors are you getting?.
Can you connect via ODBC?
Oct 30 '07 #2
slb813
8
Yes,

I was able to connect using ODBC.

Thank You !!!
Oct 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Daven Thrice | last post by:
Hi, I've converted the tables from an old Access application to MySql format. I then linked the tables into access using MyODBC and everything works great (on my computer). For now, I want to...
4
by: John Morgan | last post by:
I have Enterprise Manager on my local machine. For the last twelve months it has been connecting without problem to my online SQL Server database provided by my ISP. Three weeks ago the ISP...
1
by: Alpha | last post by:
I have a Window based application that shows up still running in the task manager when I close it. It reaches the "this.close" statement and then it stops at the "}" at the section of the...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
16
by: peshekeedweller | last post by:
Using asp.net 1.1. vb.net 2003. I am trying to connect to a remote sql server 2000 on a virtual machine running windows 2000 server. I can connect through the server explorer in visual studio,...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
5
by: bill | last post by:
I am having difficulties connecting to a remote Sql server database in VB.net. Lets say my remote server is found at 255.255.255.255 and its name is MyServer. The database is called MyDatabase....
2
by: George | last post by:
Hi all, I am trying to convert to vb.net from VB6 and I am haveing a major problem with connecting to an Access database and adding, updating, deleting data. This is what I usually use in vb6:...
1
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I...
4
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.