Connecting Tech Pros Worldwide Help | Site Map

PHP MS-Access odbc_exec() gives 'too few parameters' error

Newbie
 
Join Date: Aug 2007
Posts: 1
#1: Aug 22 '07
Im failing to update the an MS ACcess. I will appreciate Your advice. I get the error below

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:\Program Files\Apache Group\Apache2\htdocs\Test\Thomas\HelpDesk\UpdateAs sign.php on line 27

Here is the script that is generating the error.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $conn=odbc_connect("HELPDESK","" ,"");
  4.  
  5.  
  6.      $surname = $_POST['SurNametxt'];
  7.      $firstname = $_POST['firsNametxt'];
  8.      $station = $_POST['Stationtxt'];
  9.      $jobtitle = $_POST['JobTitletxt'];
  10.      $datelogged = $_POST['DateLogtxt'];
  11.      $complaint = $_POST['compl'];
  12.      $status = 'A'; 
  13.      $priority = $_POST['Priortxt'];
  14.      $technician = $_POST['Techtxt'];
  15.      $priority  = "$priority";
  16.  
  17.  
  18. if (!$conn)
  19.        {exit("Connection Failed: " .$conn);}
  20.  
  21. $update = "update hdsk_complain
  22. SET  hd_com_priority = $priority
  23. Where hd_com_jobtitle= 'SDM'";
  24.  
  25.  
  26.  
  27. $result = odbc_exec($conn, $update);
  28.  
  29.  
  30.  
  31. if (!$result) {exit('Execution failed!');} 
  32.  
  33.      odbc_close($conn);
  34. ?>
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#2: Aug 22 '07

re: PHP MS-Access odbc_exec() gives 'too few parameters' error


Heya, Joe. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Changed thread title to better describe the problem (did you know that threads whose titles contain phrases such as, 'problem' actually get FEWER responses?).
code green's Avatar
Expert
 
Join Date: Mar 2007
Location: England
Posts: 1,078
#3: Aug 24 '07

re: PHP MS-Access odbc_exec() gives 'too few parameters' error


Quote:
Too few parameters. Expected 1
Using ODBC this usually means you have an incorrect field name.
I am not saying this is a definition of the error.
Just that in my experience this is the problem.
So the problem may be your query
Expand|Select|Wrap|Line Numbers
  1. update hdsk_complain
  2. SET  hd_com_priority = $priority
  3. Where hd_com_jobtitle= 'SDM'";
Reply