ellchr3 Posted April 3, 2013 Share Posted April 3, 2013 I'm trying to find out how to use a variable in a where clause that's entered from a previous page. I have my input page set up to accept text (may be my problem since I'm looking for an integer, but may have other issues too). I'm using $_POST to pass the value to the php file. Code is below: HTML INPUT: <html> <body> <form method="post" action="display.php"> <label>provider id: <input type="text" name="providerid" /> </label> </form> </body> </html> Query information from display.php: $providerid=$_POST['providerid']; // echo "Logged In as ".$providerid; //$query = odbc_exec("SELECT provider_full_name, provider_id FROM crr.provider_dim"); $sql="SELECT provider_first_name, provider_middle_name, provider_last_name, provider_full_name, provider_id FROM crr.provider_dim where provider_id = ($providerid['providerid']['provider'])"; Quote Link to comment https://forums.phpfreaks.com/topic/276497-variable-in-where-clause-using-odbc_connect-for-sybase/ Share on other sites More sharing options...
Solution Barand Posted April 3, 2013 Solution Share Posted April 3, 2013 $sql = "SELECT ... WHERE provider_id = '$providerid' "; Quote Link to comment https://forums.phpfreaks.com/topic/276497-variable-in-where-clause-using-odbc_connect-for-sybase/#findComment-1422722 Share on other sites More sharing options...
ellchr3 Posted April 4, 2013 Author Share Posted April 4, 2013 I was making it way harder than what it was. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/276497-variable-in-where-clause-using-odbc_connect-for-sybase/#findComment-1422848 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.