- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Error on Database Acess using PHP
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2003 09:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-05-2003 01:24 AM
тАО08-05-2003 01:24 AM
Re: Error on Database Acess using PHP
I'm not an expert in access, but you have a php syntax error when you define this string :
$SQL_Exec_String = "Insert Into real (Cliente, Projeto) values ('$cliente', '$projeto')";
the $ are included in your string which means that if cliente=5 (if it's numeric), you will include $cliente (an alpha string) and not 5.
in order to include the values you have to quit the string with the " and concat your values with it.
Example :
$five=5;
$fivestringgood="this is ".$five;
$fivestringbad="this is $five";
an echo of fivestringbad :
this is $fivea
an echo of fivestringgood :
this is 5
nota : don't forget the dot . to concat strings.
For your string the correct syntax should be :
$SQL_Exec_String = "Insert Into real (Cliente, Projeto) values ('".$cliente."', '".$projeto."')";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-05-2003 05:41 AM
тАО08-05-2003 05:41 AM
Re: Error on Database Acess using PHP
I still have the error :
Warning: SQL error: [Microsoft][Driver ODBC para Microsoft Access] Erro de sintaxe na instru????o INSERT INTO., SQL state 37000 in SQLExecDirect in C:\Arquivos de programas\Apache Group\Apache2\htdocs\insert.php3 on line 41
Error in odbc_exec( no cursor returned )
Regards,
Bassoi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-05-2003 07:13 AM
тАО08-05-2003 07:13 AM
Re: Error on Database Acess using PHP
if i interpret properly, i think the trouble is then with the cursor exec function :
lines:
$SQL_Exec_String = "Insert Into real (Cliente, Projeto) Values ('$cliente', '$projeto')";
$cur= odbc_exec( $cnx, $SQL_Exec_String );
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
you are in the case Error_handler !
then odbc_exec generated an error.
To check the sql syntx, the easiest way is to echo your string before execute :
I.E.
echo $SQL_Exec_String;
just before odbc_exec.
nota, the proper syntax is '".$cliente."','".$projeto."'
Then you can see exactly what is sent to the database. May be it's just an numeric trouble :
Does you cliente column is numeric in your database, or projeto column.
If this is the case, remove the singles quotes (') of the appropriate column in the insert statement.
You can also cut and paste the output of the echo to check directly with access the syntax of your insert statement. By this way, you may have more details about the error...(probably a syntax error).
hth
Benoit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-05-2003 07:52 AM
тАО08-05-2003 07:52 AM
Re: Error on Database Acess using PHP
Hi,
The result now is:
Insert Into real (Cliente, Projeto) values ('Test1', 'Test2')
Warning: SQL error: [Microsoft][Driver ODBC para Microsoft Access] Erro de sintaxe na instru????o INSERT INTO., SQL state 37000 in SQLExecDirect in C:\Arquivos de programas\Apache Group\Apache2\htdocs\insert.php3 on line 42
Error in odbc_exec( no cursor returned )
--------------------------------------------
And the code is:
function Enter_New_Entry($cliente,$projeto) {
/*
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( 'teste' , '', '' );
if (!$cnx) {
Error_handler( "Error in odbc_connect" , $cnx );
}
$SQL_Exec_String = "Insert Into real (Cliente, Projeto) values ('".$cliente."', '".$projeto."')";
echo $SQL_Exec_String;
$cur= odbc_exec( $cnx, $SQL_Exec_String );
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
odbc_close( $cnx);
}
$strNewEntries = "Atualiza????o do Workload Concluida";
HTML_Head();
$cliente="Test1";
$projeto="Test2";
Enter_New_Entry($cliente,$projeto);
Regards,
Bassoi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-05-2003 08:45 AM
тАО08-05-2003 08:45 AM
Solutionfrom google, ODBC 37000 is syntax error or access violation error. I think it's the first .
try to send
Insert Into real (Cliente, Projeto) values ('Test1', 'Test2')
directly with access.. and check the result.
OR try with this :
Insert Into real values ('Test1', 'Test2')
if you don't have more columns in your real table.
May be "real" is a reserved word! try another name...
I'm quite sure that the error is on the odbc/msaccess side.
hope that help...
Benoit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-05-2003 08:53 AM
тАО08-05-2003 08:53 AM
Re: Error on Database Acess using PHP
The problem was in the name "real",probably is a reserved word. I rename it and work??s.
Thanks,
Bassoi