Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    50

    Unanswered: Getting data prom Oracle database

    Hi!

    I am getting the data stored in the database using definebyname and linking the results from a column to a variable, like:

    PHP Code:
    $query "SELECT nationality FROM Interpreter WHERE intName='Radiohead'";
        
    $stmt ociparse ($conn$query);
        
    ocidefinebyname ($stmt"NATIONALITY"$nationality);
    ociexecute($stmt);
    ocifetch($stmt); 
    But if I want to get some value that it's not from a specific column how can I do it?

    For instance:

    PHP Code:
    $query "SELECT trunc(months_between( trunc(sysdate), trunc(bDate) ) / 12) FROM Interpreter WHERE intName='Radiohead'";
        
    $stmt ociparse ($conn$query);
        
    ocidefinebyname ($stmt"???????"$age);
    ociexecute($stmt);
    ocifetch($stmt); 
    What should I put in the second argument of ocidefinebyname? Do I have to use other function?

    Thanks for your attention!
    Ah! Não ser eu toda a gente e toda a parte!

  2. #2
    Join Date
    Oct 2002
    Location
    Plymouth UK
    Posts
    116
    Give the returned column a name. Like this:

    Code:
    $query = "SELECT trunc(months_between( trunc(sysdate), trunc(bDate) ) / 12) age FROM Interpreter WHERE intName='Radiohead'";
        
    $stmt = ociparse ($conn, $query);
        
    ocidefinebyname ($stmt, "AGE", $age);
    ociexecute($stmt);
    ocifetch($stmt);

  3. #3
    Join Date
    Dec 2003
    Posts
    50
    Ok. Thanks a lot for your answer !
    Ah! Não ser eu toda a gente e toda a parte!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •