Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 8th, 2002, 02:13 PM
AlexNinjaFighte AlexNinjaFighte is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Pittsburgh PA USA
Posts: 105 AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 16 h 30 m 20 sec
Reputation Power: 8
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

Reply With Quote
  #2  
Old August 8th, 2002, 08:15 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 27 m 47 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
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.

Reply With Quote
  #3  
Old August 8th, 2002, 09:45 PM
AlexNinjaFighte AlexNinjaFighte is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Pittsburgh PA USA
Posts: 105 AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 16 h 30 m 20 sec
Reputation Power: 8
Thanks for the explanation Onslaught.
Alex

Reply With Quote
  #4  
Old November 25th, 2003, 08:34 PM
xinelo xinelo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Barcelona
Posts: 11 xinelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 7 sec
Reputation Power: 0
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

Reply With Quote
  #5  
Old November 25th, 2003, 08:51 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,653 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 6 Days 12 h 34 m 33 sec
Reputation Power: 981
xinelo, your query looks like table T_champ is missing from the FROM clause


rudy

Reply With Quote
  #6  
Old November 25th, 2003, 09:43 PM
xinelo xinelo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Barcelona
Posts: 11 xinelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 7 sec
Reputation Power: 0
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.

Reply With Quote
  #7  
Old November 25th, 2003, 09:45 PM
xinelo xinelo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Barcelona
Posts: 11 xinelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 7 sec
Reputation Power: 0
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.

Reply With Quote
  #8  
Old November 26th, 2003, 05:42 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,653 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 6 Days 12 h 34 m 33 sec
Reputation Power: 981
is T_champ.Champ numeric? then do not put quotes around 865

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Error message from MS Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway