Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 12th, 2006, 02:01 PM
maron maron is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 4 maron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 57 m 18 sec
Reputation Power: 0
Unhappy Can anybody help me....

em newbie using php and ms access can anybody help me?i have problem using ms access as my database,em gettin errors like this:

Notice: Undefined variable: Firstname in C:\cgi\dataAccess.php on line 95

Notice: Undefined variable: Lastname in C:\cgi\dataAccess.php on line 95

Notice: Undefined variable: PhoneNumber in C:\cgi\dataAccess.php on line 95

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in C:\cgi\dataAccess.php on line 81
Error in odbc_exec( no cursor returned )

==================================================

here's my coding

1. formInput.php

<?php

function HTML_Head() {
echo "
<HTML><HEAD>
<TITLE>Processing Form</TITLE>
</HEAD>
<BODY BGCOLOR=\"#D5D5AB\">";
}

function HTML_Form() {

echo "
<FORM METHOD=post ACTION=\"dataAccess.php\">
Please enter the details you wish to be inserted into the Access Database.<br>
First Name:<input name=\"Firstname\" type=\"text\" SIZE=\"25\"><br>
Last Name:<input name=\"Lastname\" type=\"text\" SIZE=\"25\"><br>
Phone Number: <input name=\"PhoneNumber\" type=\"text\" SIZE=\"25\"><br>
<p><INPUT type=\"Submit\" name=\"submit\" value=\"Submit\">
</p></form>
";
}

function HTML_Existing() {
echo "Existing database entries";
}

function HTML_Foot() {
echo "</body></html>";
}

HTML_Head();
HTML_Form();
HTML_Existing();
HTML_Foot();

?>

================================================== ==

2. dataAccess.php

<?php

function HTML_Head() {
echo "
<HTML><HEAD>
<TITLE>Processing Form</TITLE>
</HEAD>
<BODY BGCOLOR=\"#D5D5AB\">";
}

function HTML_Foot() {
echo "</body></html>";
}

function Database_Entries($msg) {
echo $msg;
}

function Output_Entries() {
/*
Make the connection to the database. The syntax is
odbc_connect( 'SYSTEM_DSN' , 'USER', 'PASSWORD' );
$cnx will hold the
pconnect is used to establish a persistent database
connection to the Database until the procedure is completed.
*/

$cnx = odbc_connect( 'sample' ,'root', '' );
if (!$cnx) {
Error_handler( "Error in odbc_connect" , $cnx );
}

// send a simple odbc query . returns an odbc cursor
$cur= odbc_exec( $cnx, "select Index,Firstname,Lastname,PhoneNumber from People" );
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
echo "<table border=1><tr><th>Index</th><th>First Name</th>".
"<th>Last Name</th><th>Phone Number</th></tr>\n";
$nbrow=0; //Local variable to count number of rows

// fetch the succesive result rows
while( odbc_fetch_row( $cur ) ) {
$nbrow++;
$Index= odbc_result( $cur, 1 ); // get the field "Index"
$Firstname= odbc_result( $cur, 2 ); // get the field "FirstName"
$Lastname= odbc_result( $cur, 3 ); // get the field "LastName"
$PhoneNumber= odbc_result( $cur, 4 ); // get the field "PhoneNumber"

echo "<tr><td>$Index</td><td>$Firstname</td>".
"<td>$Lastname</td><td>$PhoneNumber</td></tr>\n";
}

echo "<tr><td colspan=2>$nbrow entries </td></tr></table>";

// close the connection. important if persistent connection are "On"
odbc_close( $cnx);
}

function Error_Handler( $msg, $cnx ) {
echo "$msg \n";
odbc_close( $cnx);
exit();
}

function Enter_New_Entry ($Firstname, $Lastname, $PhoneNumber) {

/*
First, we create a connection to our ODBC source. This is done by creating
a connection. Once this is done, we are returned an ODBC connection number.
We use this number to use the ODBC functions within PHP.
*/

$cnx = odbc_connect( 'sample' , 'root', '' );
if (!$cnx) {
Error_handler( "Error in odbc_connect" , $cnx );
}
$SQL_Exec_String = "Insert Into People (Firstname, Lastname, PhoneNumber)
Values ('$Firstname', '$Lastname', '$PhoneNumber')";

$cur= odbc_exec( $cnx, $SQL_Exec_String );
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}

odbc_close( $cnx);
}

$strOldEntries = "Previous Entries in database";
$strNewEntries = "Updated version of databse (after entries)";

HTML_Head();
Database_Entries($strOldEntries);
Output_Entries();
Enter_New_Entry ($Firstname, $Lastname, $PhoneNumber);
Database_Entries($strNewEntries);
Output_Entries();
HTML_Foot();

?>


can anybody here help me to figure out where i went wrong??
thanx in advance.. c",)

Reply With Quote
  #2  
Old July 13th, 2006, 10:34 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 997 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 904898 Folding Title: Super Ultimate Folder - Level 2Folding Points: 904898 Folding Title: Super Ultimate Folder - Level 2Folding Points: 904898 Folding Title: Super Ultimate Folder - Level 2Folding Points: 904898 Folding Title: Super Ultimate Folder - Level 2Folding Points: 904898 Folding Title: Super Ultimate Folder - Level 2Folding Points: 904898 Folding Title: Super Ultimate Folder - Level 2Folding Points: 904898 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 14 h 26 m 27 sec
Reputation Power: 5
Send a message via ICQ to Itsacon
I have no personal experience with MS Access, but a quick google search gives me the impression the `Operation must use an updateable query' error occurs when you have insufficient rights to the database.

Are you sure your permissions are set correctly?
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 280

Reply With Quote
  #3  
Old July 13th, 2006, 03:54 PM
maron maron is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 4 maron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 57 m 18 sec
Reputation Power: 0
i dunno???

actually i dunn0..??
like i said em only a begginer using php &
ms access as my database but
em quite sure that i have permission to
write on file cause it shows on my default web site
that it is ENABLED TO READ,WRITE, & EXECUTE..
if em wr0ng can u kindly correct me? and can
y0u teach me to enable the permission to write
in my database(ms access)...
by the way thanx for y0ur help...
c",)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Can anybody help me....


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT