#37490 [Opn->Bgs]: I have Error in Inserting item to my DB
| From: | bjori@php.net | Date: | Thu, 18 May 2006 09:11:13 +0000 |
| Subject: | #37490 [Opn->Bgs]: I have Error in Inserting item to my DB | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97307@lists.php.net to get a copy of this message | ||
ID: 37490
Updated by: bjori@php.net
Reported By: peymaniu1 at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: ODBC related
Operating System: Windows XP
PHP Version: 5.1.4
New Comment:
.
Previous Comments:
------------------------------------------------------------------------
[2006-05-18 08:57:39] peymaniu1 at yahoo dot com
Description:
------------
Hi
I have problem when inserting data to my MS Access DB.
It gives error
I'm using odbc_exec () function.
Can anyone help me please!
I have to submit my project on saturday!
Reproduce code:
---------------
<?php
$db = odbc_connect('ezLearning', 'peyman', 'attarzadeh') or
die('Could
Not Connect to ODBC Database!');
require_once('test2_complete.php');
$a=$_POST["username"];
$b=$_POST["password"];
$q = "INSERT INTO [t1]([username],[password]) VALUES ($a,$b);";
odbc_exec ($db,$q);
odbc_close($db);
?>
Expected result:
----------------
the result should be anything you entered for the values $a and $b.
Actual result:
--------------
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC
Microsoft Access Driver] Too few parameters. Expected 2., SQL state
07001 in SQLExecDirect in
c:\Inetpub\wwwroot\ezLearning\test2_complete.php on line 14
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37490&edit=1