Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8469371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:12:33+00:00 2026-06-10T16:12:33+00:00

I’m trying to extract data from a table in access database using odbc connection

  • 0

I’m trying to extract data from a table in access database using odbc connection and php. I have written the code below but it gives error “Uncaught exception ‘com_exception’ with message ‘Source: Microsoft OLE DB Provider for ODBC Drivers
Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ‘table1.col_date”

<?php $cn = new com("ADODB.Connection");
 $rs = new com("ADODB.Recordset");

$cn->open("dsn=odbcconnection");
?>
<form action = "thispage.php" method = "post">
Enter Date : <input type = "text" name = "datadate" />
<input type = "submit" name = "submit" value = "submit" /> 
</form>
<?php
$datadate = isset($_REQUEST['datadate']) ? $_REQUEST['datadate'] : null; ?>

<?php $sql = "select col_date, sum(qty1), sum(qty2) from table1
              where  table1.col_date = '".$datadate."'
              group by col_date
              order by col_date";

// Execute query
$rs = $cn->execute($sql);

I think there is a problem in only parameter line table1.col_date = $datadate because when I replace $datadate with static date like table1.col_date = #05/08/2012# , it displays output correctly for the date

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:12:34+00:00Added an answer on June 10, 2026 at 4:12 pm

    The problem is that is either you are using query string parameters posting to the current page which are empty or you are getting confused with POST. Try the following

    If you are posting to the page itself then do the following

    <form action = "<?php echo $PHP_SELF; ?>" method = "post"> 
    

    then change the the to the following:

    $datadate = isset($_POST['datadate']) ? $_POST['datadate'] : null; ?>
    

    Lastly make the change as previously stated

    Replace the [table1.col_date] with [table1].[col_date] or remove the brackets completely
    and try the following

    <?php $sql = "select col_date, qty1, qty2 from table1 where  [table].[col_date]= '".$datadate."' group by col_date order by col_date"; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a view passing on information from a database: def serve_article(request, id): served_article
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.