Solved

odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters.

Posted on 2010-11-09
2
2,124 Views
Last Modified: 2012-05-10
I have a client that is running PHP script to update some pricing and item descriptions in an SQL database.  Since we moved the Access database to a new server, we have been having problems.  I have completely redone the ODBC for this app and all the other components are working except this one.  I can't imagine anything else has changed that would cause this error.  It was working fine before we moved the database and once we re-established the ODBC all other components of this web frontend are working except this one.
Error Message:
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in C:\wamp\www\ItemUpdate\UpdateItemDescriptions.php on line 113

Code:starting at line 112;  $connect1 is defined earlier in the code and seems to work in the other PHP script

$query1 = "SELECT RefNum,SHORT_DESCRIPTION FROM AllPrices ORDER BY RefNum";
$result1 = odbc_exec($connect1,$query1);

$itemcount=0;
while (odbc_fetch_row($result1)) {
  //put the data into an array; we'll pop the data later if it is the same in the Inventory system
  $itemref = odbc_result($result1,"RefNum");
  $itemdesc = odbc_result($result1,"SHORT_DESCRIPTION");
  $pbArray[$itemref] = $itemdesc;
  ++$itemcount;


thanks for the help


0
Comment
Question by:chenault68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
darren-w- earned 500 total points
ID: 34094517
Hi,

it may be something to do with how your ref number is being added?

try echoing  the $query1 line out before issuing the call and copy the calling line into you sql client to see if it works.
0
 

Author Closing Comment

by:chenault68
ID: 34123506
Thanks for the help
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question