By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,176 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Question on how to query db

P: 36
Hi

Im working with php and an oracle database. Anyway I am having a user input into a text field. The input is then stored into a variable and used in a query to the database. I am currently testing this program and I am trying to see the exact result of the query by just echoing the result using var_dump. So the problem is I cant get the actual result of the query out on the screen. For example I type in "59" into the input field already knowing that this value is in the db. I then output the variable I store the query result in and I dont get the same number. I actually get either blank or the word "NULL". I dont know what the problem is Ive been torturing myself trying to figure this out. I want to compare the users input to actualy info in the db. So if I say "select 59 from table" I want the result to be 59. Can someone take a look and see if they can find anything wrong or see if this is how the query should be to get the result I want to obtain.
Thanks

Heres the code piece:

Expand|Select|Wrap|Line Numbers
  1. //create the text field
  2. echo("<input type=text name=opt_qty value=".$_SESSION['opt_qty_vals'][$opt_indx]." onBlur='submit();' class='qty_input'>");
  3. echo("</td>");
  4. //store user input
  5. $user_input_strike = $_GET['opt_qty'];
  6. //create the query
  7. $query1 = "select strike from surfaces where undl_indx = $undl_indx and and expire_date = ".$_SESSION['opt_exd_vals'][$opt_indx]." and call_put = '".$_SESSION['opt_cp_vals'][$opt_indx]." and strike =$user_input_strike";
  8. //prepare query
  9. $parsed1 = ociparse($db_conn, $query1);
  10. //Execute statment
  11. $succ1 = ociexecute($parsed1);
  12. //from  what I understand this stores everything in an array.
  13. $results = oci_fetch_all($succ1);
  14.  
  15. //output array for debugging purposes.
  16. var_dump("$results2");
  17.  
  18.  
Jul 20 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.