Sign in to follow this  
bender

how to get rid of this MS Access error???

Recommended Posts

Hi everybody!

 

 

 

I have a problem...my code seems to have this Access error..I've checked many times but I can't find what's wrong with it...

 

 

 

This is the error I get: Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause., SQL state 37000 in SQLExecDirect in C:wampwwwJPS Projekel69.php on line 43

 

37000

 

 

 

Can somebody help me identify the error? I attached my code below if you wanna see it...thanks so much in advance!

graphprob.txt

Share this post


Link to post
Share on other sites

Hi,

  Due to '-', could you please use table name and field name with in SQL Command like that way [Table-Name]

  ### your Code ###

  $strQuery = "SELECT * FROM dpd-btu-vwp";

 

  ### Use Like This way ###

  $strQuery = "SELECT * FROM [dpd-btu-vwp]";

 

  $strQuery = "SELECT [VWP-10] FROM [DPD-BTU-VWP] WHERE [VWP-10]=" .$ors['VWP-10'];

  $strQuery = "SELECT [VWP-11] FROM [DPD-BTU-VWP] WHERE [VWP-11]=" .$ors['VWP-11'];

  $strQuery = "select [VWP-12] from [DPD-BTU-VWP] where [VWP-12]=" .$ors['VWP-12'];

 

  $strQuery = "select [VWP-13] from [DPD-BTU-VWP] where [VWP-13]=" .$ors['VWP-13'];

 

  $strQuery = "select [VWP-14] from [DPD-BTU-VWP] where [VWP-14]=" .$ors['VWP-14'];

Share this post


Link to post
Share on other sites

Hi Arindam,

 

 

 

Thanks for helping me...I've tried your solution, but I get a new error...

 

 

 

 

 

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '[VWP-10]='., SQL state 37000 in SQLExecDirect in C:wampwwwJPS Projekel79.php on line 56

 

37000

 

 

 

Why is this? I wrote it like this:

 

 

 

"SELECT [VWP-10] FROM [DPD-BTU-VWP] WHERE [VWP-10]=" .$ors['VWP-10'];

 

 

 

Can you please check what's wrong? Thank you very much..

Share this post


Link to post
Share on other sites

Hi,

 Need to debug your program. First of all please check whether SQL Query working or not. Please check SQL Query with in Access Data base. Will you send me table structure? Please tell me how you want to show your data with in chart? With out table structure I am unable to do debug.

Also you can build your logic this way. see attachment

MSAccess_php.txt

Edited by Guest

Share this post


Link to post
Share on other sites

My database name is 'DMU' and inside it contains many tables...but this particular table that I want to include is called 'DPD-BTU-VWP'...inside this table contains attributes:

 

 

 

ID, Date, Res lvl, VWP-1 until VWP-21...

 

 

 

So I wanna select 5 set of data (VWP-10 until VWP-14) and plot it so that x-axis is the date, and there will be 5 lines to plot according to VWP.

 

 

 

Lol I hope you understand what I'm trying to say. Thanks for helping!

Share this post


Link to post
Share on other sites

hi Arindam!

 

 

 

Actually I've found out what's wrong...there's nothing wrong with the coding, but the database is wrong! Some rows for the date doesn't have values for VWP-10, so it's blank there. So I try filling in the blanks with 0's and the graph appears without errors! thanks for helping me and my problem with Access is solved.

 

 

 

Now, my graph is very small for a graph which holds lots of data...can you teach me how to make it larger? thank you so much...you can take a look at my current graph in attachment..

post-2656-128441567494_thumb.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this