I'm currently working on a project to setup a webform coded in PHP that has two functions.
Function 1: Generate an E-mail to a specified e-mail address in a specified format. (I have got this working no problem).
Function 2: My second function is i want to have the same information sent in the email in function 1 sent to a database as well either in the same code or in different code i currently have it set-up in the same script.
I have hosted my form and the Function 2 of the script on the Frihhost servers for testing. I am using a very basic form in order to isolate all issue before i commit massive amounts of variables to it.
Whenever i run the script it gives me an error message.
Previous Entries in database
Fatal error: Call to undefined function: odbc_connect() in /home/scottyto/domains/scotty.frih.net/public_html/work/DataAccess.php3 on line 21
I do have my ODBC connection set up locally on my computer. Would this need to be setup on the server i am hosting from? Because i am hosting from Frihost, i am unable to create on unless someone can explain to me how.
-OR-
Can this be host locally, and i am just unable to get it set up?
This is my coding.
Any Help is very much appretiated,
Function 1: Generate an E-mail to a specified e-mail address in a specified format. (I have got this working no problem).
Function 2: My second function is i want to have the same information sent in the email in function 1 sent to a database as well either in the same code or in different code i currently have it set-up in the same script.
I have hosted my form and the Function 2 of the script on the Frihhost servers for testing. I am using a very basic form in order to isolate all issue before i commit massive amounts of variables to it.
Whenever i run the script it gives me an error message.
Previous Entries in database
Fatal error: Call to undefined function: odbc_connect() in /home/scottyto/domains/scotty.frih.net/public_html/work/DataAccess.php3 on line 21
I do have my ODBC connection set up locally on my computer. Would this need to be setup on the server i am hosting from? Because i am hosting from Frihost, i am unable to create on unless someone can explain to me how.
-OR-
Can this be host locally, and i am just unable to get it set up?
This is my coding.
| Code: |
|
<?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() { $cnx= odbc_connect( 'Trial' , 'root', '' ); if (!$cnx) { Error_handler( "Error in odbc_connect" , $cnx ); } $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; while( odbc_fetch_row( $cur ) ) { $nbrow++; $Index= odbc_result( $cur, 1 ); $FirstName= odbc_result( $cur, 2 ); $LastName= odbc_result( $cur, 3 ); $PhoneNumber= odbc_result( $cur, 4 ); 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>"; odbc_close( $cnx); } function Error_Handler( $msg, $cnx ) { echo "$msg \n"; odbc_close( $cnx); exit(); } function Enter_New_Entry($FirstName,$LastName,$PhoneNumber) { $cnx = odbc_connect( 'Trial' , '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(); ?> |
Any Help is very much appretiated,
