|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Error message from MS Access
I am changing the php scripts for adding data to a MSAccess db. The scripts worked fine, but some fields are no longer needed and new ones are required. In the process of updating I testing my php and I got this error message:
: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in c:\apache group\apache\htdocs\beryl\wwwroot\update.php on line 89 The error I'm guessing is because I have not yet modified the database -- or is something else going on? Alex |
|
#2
|
||||
|
||||
|
That is what it sounds like.
If you do an insert into the database and do not list the fields that are going to have data inserted into it, then you can break the script by not passing the correct amount of fields that the database is expecting. You can override this by simply stating which fields will be inserted. i.e. insert into your_table(column1, column3, column5) values('value1','value2','value3'); With this style it doesn't matter if the table contains 5 columns or 50, just as long as you are passing the fields that are required (not null) and the columns exist in the table. |
|
#3
|
|||
|
|||
|
Thanks for the explanation Onslaught.
Alex |
|
#4
|
|||
|
|||
|
similar error with select
Hello!
I´ve got a similar problem, well actually it´s the same error, but I´m not trying to insert but to select. Any ideas? Thank you a lot!! This is what I get: $sql = "SELECT * FROM t_termino WHERE t_termino.Champ = T_champ.Num AND T_champ.Champ = 'Natation'"; $rs = odbc_exec($conn, $sql); if (!$rs) { exit("Error in SQL"); } Warning: odbc_exec(): SQL error: [Microsoft][Controlador ODBC Microsoft Access] Pocos parámetros. Se esperaba 1., SQL state 07001 in SQLExecDirect in c:\archivos de programa\easyphp1-7\www\jo\exok_2000.php on line 24 Error in SQL |
|
#5
|
||||
|
||||
|
xinelo, your query looks like table T_champ is missing from the FROM clause
rudy |
|
#6
|
|||
|
|||
|
thanks
Thank you very much, Rudy
You were right there, I missed that bit. So now I tried $sql = "SELECT * FROM t_termino, T_champ WHERE t_termino.Champ = T_champ.Num AND T_champ.Champ = '865'"; $rs = odbc_exec($conn, $sql); if (!$rs) { exit("Error in SQL"); } to get a different kind of error (that´s an improvement! ![]() Warning: odbc_exec(): SQL error: [Microsoft][Controlador ODBC Microsoft Access] No coincide el tipo en la expresión., SQL state S1000 in SQLExecDirect in c:\archivos de programa\easyphp1-7\www\jo\exok_2000.php on line 24 Error in SQL So before allegedly there weren´t enought parameters and now there's a data type mismatch in criteria expression (?). There`s somethinig very weird because before I tried $sql = "SELECT * FROM t_termino ORDER BY cleFr; and I got a different list but not at all order (by the way, the query $sql = "SELECT * FROM t_termino; works perfectly and returns the 20,000 records in the table. Last edited by xinelo : November 25th, 2003 at 10:14 PM. |
|
#7
|
|||
|
|||
|
Thought some more details might help...
I´m trying to query a table (from a db in Access) whose field 'Champ' stores a sport, taking the value from a select list (a list of options). These options are stored in the 2nd field of another table called 'T_champ', wheres unique identifier is stocked in the 1st field (T_champ.Num, T_champ.Champ). This id number is in fact what is stored in 't_termino.Champ' when one chooses a particular sport from the list of options. This might be a bit tricky to explain if you´re not familiar with MS Access.
So before I was trying $sql = "SELECT * FROM t_termino WHERE Champ = 'Natation'"; and $sql = "SELECT * FROM t_termino WHERE Champ = '865'"; with no success. That´s why I chose to bring in the other table. I thought it might be a problem of ODBC configuration so I tried to create the same table in MySQL but still I encounter problems too (see http://forums.devnetwork.net/viewto...4886&highlight= ) so I´m stuck Thanks again Rudy. I hope all of this sheds some light over my problem. |
|
#8
|
||||
|
||||
|
is T_champ.Champ numeric? then do not put quotes around 865
|
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Error message from MS Access |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|