473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need help querying a db

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
1 1111
debasisdas
8,127 Expert 4TB
If the data is in databse table it will never happen that the output will be NULL or anything else.

There must be some probelm in the program.
as i have on idea of PHP ,would suggfest you to try parsing the input variable to proper type.
Jul 21 '07 #2

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

Similar topics

4
by: Michael Whittaker | last post by:
Hello! I have a problem with my php script. The script's task is to search an IP-Database with ranges as entries and find, in which range the entered IP is. OK, I've queried the MySQL-Results...
3
by: Keith | last post by:
I am fairly new to SQL so sorry if this is a really dumb question. I have a small (still) SQL database, which I am trying to query from an ASP page. The field I am querying is of DATETIME data...
1
by: valexena | last post by:
After a few minutes of querying the database my session disconnects abruptly. Can somebody help me and tell why can be happening? -- Posted via http://dbforums.com
1
by: Ron L. | last post by:
Hi, Any suggestions for a good intorudction to OLAP querying with MDX? Thanks, Ron. -- Performance Intelligence, Inc. Spy 4 DB2 - http://www.pireporting.com/spy4db2.html
3
by: amore | last post by:
im new in xml. It looks like large xml data(inside elements) was truncated every time i open it on my editor(dreamweaver or visual studio). is there any way of fixing that? which is faster,...
2
by: Elliot Rodriguez | last post by:
As I continue to read more about the benefits of database querying using ADO.NET, I am having a more difficult time distinguishing what the best approach to data retrieval is anymore. When...
3
by: MDB | last post by:
I'd normally Google for a question like this, and hope to snag a few examples along with the answer, but this time I can't see to get the keywords specific enough. Or I'd ask coworkers, but...
1
by: Stephane | last post by:
Hi, In my ASP.Net application, I want to read a list of RSS feed every 30 minutes. To start this, I check the current minute and I do a modulo 30. Once it's started, I check in my database and I...
9
by: Algonquin J. Calhoun | last post by:
I've developed an application that exceeds the Access 2GB limit. This application was developed as a prototype and the users have found it very useful. Approximately 45,000 records are added to...
4
by: =?Utf-8?B?U3VoYXMgVmVuZ2lsYXQ=?= | last post by:
Hello, I am facing an issue while querying Active directory using C# code with system.DirectoryServices namespace. Here is the path for my LDAP - "LDAP://CN=XY - C++/Unix and other,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.