Rockas Posted June 18, 2009 Share Posted June 18, 2009 Hi everybody, good morning. I am trying to set a variable for a piece of code to export XLS files and i have th following variable: $export->xls ( "localhost" , "database" , "user" , "password" , "SELECT * FROM tabela WHERE filtro = %s ORDER BY Ref ASC" , "ficheiro_excel" ); When i run the code i get the following error message in the browser: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s ORDER BY Ref ASC' at line 1 Can anyone help me to fix this? Thank you and please forgive my english Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted June 18, 2009 Share Posted June 18, 2009 Well we have no idea what $export is, or exactly what its xls method does, but it may be the %s in your SQL statement.... what are you expecting %s to actually be? Quote Link to comment Share on other sites More sharing options...
Rockas Posted June 18, 2009 Author Share Posted June 18, 2009 $export is a variable xls method exports the results of a query to a Microsoft Excel file format "*.xls" % is a filter of the query so i can open the page as example http://export.php?filtro=sample thank you Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted June 18, 2009 Share Posted June 18, 2009 $export is a variableNot quite true. It's an object, an instantiation of some class or other. Without knowing the actual class, we can only speculate about what it does. xls method exports the results of a query to a Microsoft Excel file format "*.xls"That we could guess, without knowing any details of how it does it. Your error is coming from somewhere in this black box.... without knowing anything about how the box actually works, we can't do much. % is a filter of the query so i can open the page as example http://export.php?filtro=sample So where are you defining this filter? What value are you setting it to? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.