Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Data Submission - MS Access
Old 12-07-2005, 03:41 PM Data Submission - MS Access
croix's Avatar
Skilled Talker

Posts: 87
Name: Colin Roy
Location: Dallas, TX
Trades: 0
Im new to databases, and Im not sure what the problem is, so I'll just post what I know.

heres the code, from line 91 - 111, with the error lines in bold (94 and 110)

Code:
  $SQL_Exec_String = "Insert Into customers (FirstName, LastName, Address1, Address2, City, State, Zip, Email, LubricantChoice)
            Values ('$FirstName', '$LastName', '$Address1', '$Address2', '$City', '$State', '$Zip', '$Email', '$LubricantChoice')";
 
    $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,$Address1,$Address2,$City,$State,$Zip,$Email,$LubricantChoice);
Database_Entries($strNewEntries);
when i hit submit on the entry page, it displays the old records in my table, and below it, it shows this:

Notice: Undefined variable: FirstName in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Notice: Undefined variable: LastName in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Notice: Undefined variable: Address1 in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Notice: Undefined variable: Address2 in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Notice: Undefined variable: City in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Notice: Undefined variable: State in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Notice: Undefined variable: Zip in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Notice: Undefined variable: Email in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Notice: Undefined variable: LubricantChoice in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 110

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Field 'customers.FirstName' cannot be a zero-length string., SQL state S1000 in SQLExecDirect in D:\websites\Sliquid\wwwRoot_Sliquid\html\db\dataac cess.php on line 94
Error in odbc_exec( no cursor returned )


also, it does not add the new record to the database.

Last edited by croix; 12-08-2005 at 07:04 PM..
croix is offline
Reply With Quote
View Public Profile Visit croix's homepage!
 
 
Register now for full access!
Old 12-09-2005, 03:10 AM
Skilled Talker

Posts: 70
Trades: 0
It appears that you haven't defined what the variables $firstname, $lname, $address, etc. are. You would need to have a class definition somewhere in your site, as well as a link to that class definition. Also, make sure you assign any variable names to their posted counterparts, for example:

PHP Code:
$firstname $_POST['firstname'];
$lastname $_POST['lastname'];
$address $_POST['address'];
// more definitions 
Then you would need to include the class definition file like this:

PHP Code:
include 'class.php'
If you have trouble with class definitions let me know.
cerebro89 is offline
Reply With Quote
View Public Profile
 
Old 12-09-2005, 10:54 AM
croix's Avatar
Skilled Talker

Posts: 87
Name: Colin Roy
Location: Dallas, TX
Trades: 0
that did it

Thanks!!

Last edited by croix; 12-09-2005 at 11:06 AM..
croix is offline
Reply With Quote
View Public Profile Visit croix's homepage!
 
Old 12-14-2005, 07:47 AM
Skilled Talker

Posts: 70
Trades: 0
glad to help

did you end up using a class definition file or did you just declare the variables? speaking of which instead of declaring each of the posted variables manually you could use the following code (i just found this out today):

PHP Code:
while(list($key,$val) = each($_POST) {
$
$key $val;

i suggest you backup your original files before using this code though, as i haven't tried this myself yet, just found out from another talker.
cerebro89 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Data Submission - MS Access
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19705 seconds with 12 queries