Results 1 to 3 of 3

Thread: query appending using an array?

  1. #1
    Join Date
    Jun 2006

    query appending using an array?

    I have built a search script that searches based on what a user has entered. In this case, the user has entered a value into a textfield that is brought in with the GET method. I use that value to find the S_NUM to those matching values.

    Using this while loop echoes each S_NUM for each match, however, when I run the appended query, the query only uses the LAST matching S_NUM and I get one record. For example, there may be 3 S_NUM's that match the query (56, 58, 59) and the appending query only displays one record (59) when I need 3:

    PHP Code:
    # start of $querySearch here and I'm appending to it based on some criteria
    # criteria:
    if ( !empty($_GET['searchStudent']) )
    $gotStudent $_GET['searchStudent'];
    $queryStudentResult "
      SELECT s_num
      FROM student
      WHERE student.s_first LIKE '%" 
    $gotStudent "%' OR student.s_last LIKE '%" $gotStudent "%'

      while ( 
    ocifetch($studentResult) )
    $studentNum ociresult($studentResult,"S_NUM");
    "<br>studentNum: " $studentNum "<br>";
    $querySearch.= "AND call.s_num = " $studentNum " ";

    I also realize I need to make some upper/lower changes with using LIKE, but first I'm just trying to get this appending functioning. How to I manipulate an array to get my desired results here? I have also tried using foreach within the While loop. Btw, I'm using PHP 4.

  2. #2
    Join Date
    Jul 2005
    Try using oci_fetch_array:

    PHP Code:
    while ($row oci_fetch_array ($statementOCI_NUM)) { 
    Last edited by Webnerd; 10-12-2007 at 10:39 AM.
    Bitter web veteran

  3. #3
    Join Date
    Jun 2006
    Thanks for your reply. I have tried using that function but it is not compatible with PHP 4: http://us2.php.net/manual/en/functio...etch-array.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles