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:
# start of $querySearch here and I'm appending to it based on some criteria
if ( !empty($_GET['searchStudent']) )
$gotStudent = $_GET['searchStudent'];
$queryStudentResult = "
WHERE student.s_first LIKE '%" . $gotStudent . "%' OR student.s_last LIKE '%" . $gotStudent . "%'
$studentResult= ociparse($connect, $queryStudentResult);
while ( ocifetch($studentResult) )
$studentNum = ociresult($studentResult,"S_NUM");
echo "<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.