Jump to content

Recommended Posts

HI guys,

 

I have made a query in oci which works, the result should be a date format as in "2015-10-13" for example,

the query can only return 1 "answer" however how can I get the result in a variable?

 

the query is:

$start = oci_parse($conn, 
"
SELECT
TO_CHAR(MIN(FLT_COM_DEP_BLK),'YYYY-MM-DD')
FROM 
MASTER.FLIGHTS 
WHERE 
FLT_LFS_ID=100
AND INSTR(UPPER(FLT_TEXT_AS_SPECIAL),'_CID='||'$contractnr')>0
");
	
oci_execute($start); 

I want this result in a variable called $startd.

 

thanks for the help.

Yannick 

Edited by bogaert-y
Link to comment
https://forums.phpfreaks.com/topic/298563-result-from-oci-query/
Share on other sites

is your code producing any php errors or any oci errors? is your code producing a completely blank page or does anything on the page get output to the browser and its just the query result that doesn't get output?

 

if you read any of the 'help my page/query doesn't produce any output' posts on any of the php programming help forums, you will notice a common thread, displaying php errors and testing for and displaying database statement errors. you must ALWAYS have php's error_reporting set to E_ALL and for development/debugging display_errors should be set to ON. these two settings should be in the php.ini on your development system, so that they will report php parse/syntax errors and so that you don't need to remember to put them into the code you are developing/debugging.  all the database statements that can fail due to an error (connection, prepare/parse, query/execute) must ALWAYS test for errors and handle them in a meaningful way. for development/debugging, you would want to display the database error information.

 

next, queries that run successful can still match zero rows and in most cases you should use your database's num_rows function/method (see oci_num_rows()) to test for and handle this case.

 

if your code was already was doing these things, it (your code) would be telling you if, where, and way it is failing.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.