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'])"; 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...
Barand Posted April 3, 2013 Share Posted April 3, 2013 $sql = "SELECT ... WHERE provider_id = '$providerid' "; 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! 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
Archived
This topic is now archived and is closed to further replies.