contraboybish Posted January 2, 2010 Share Posted January 2, 2010 I'm getting the following error..... Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '* Search WHERE sId='171''., SQL state 37000 in SQLExecDirect in C:\xampp\htdocs\lbm\search\news.php on line 36 [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '* Search WHERE sId='171''. <div id="mainContent"> <?php require_once('../App_Data/odbc_open.php'); [b]query = odbc_exec($odbc, "SELECT * Search WHERE sId='$_GET[sid]'") or die (odbc_errormsg());[/b] while($row = odbc_fetch_array($query)) { echo '<tr style="text-align:justify">'; echo '<td valign="top" colspan="2">'; echo '<div style="padding-right:7px"><i><a href="'.$row['nUrl'].'" class="style2" > '.$row['sHeading'].'</a> </i><br /></div>'; echo '</td>'; echo '</tr>'; } odbc_close($odbc); ?> </div> I think there is something wrong with the select command.... query = odbc_exec($odbc, "SELECT * Search WHERE sId='$_GET[sid]'") or die (odbc_errormsg()); Any thoughts anyone :-( Quote Link to comment https://forums.phpfreaks.com/topic/186932-possible-select-error/ Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2010 Share Posted January 2, 2010 you forgot the "FROM" SELECT * FROM Search WHERE sId='$_GET[sid]' Quote Link to comment https://forums.phpfreaks.com/topic/186932-possible-select-error/#findComment-987128 Share on other sites More sharing options...
contraboybish Posted January 2, 2010 Author Share Posted January 2, 2010 oops, ok l added FROM but l now get the following error...... :-( Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression., SQL state 22005 in SQLExecDirect in C:\xampp\htdocs\lbm\search\news.php on line 36 [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. Quote Link to comment https://forums.phpfreaks.com/topic/186932-possible-select-error/#findComment-987133 Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2010 Share Posted January 2, 2010 I think your sId is a numeric value, so the following should work! SELECT * FROM Search WHERE sId= $_GET[sid] Quote Link to comment https://forums.phpfreaks.com/topic/186932-possible-select-error/#findComment-987134 Share on other sites More sharing options...
contraboybish Posted January 2, 2010 Author Share Posted January 2, 2010 Yes that it, it was numeric, must be the new year drink :-) Many Thanks Quote Link to comment https://forums.phpfreaks.com/topic/186932-possible-select-error/#findComment-987138 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.