diff options
author | prashant | 2015-01-30 20:56:49 +0530 |
---|---|---|
committer | prashant | 2015-01-30 20:56:49 +0530 |
commit | 27f39e80b66881dce2c66c30426efc83dae63ac1 (patch) | |
tree | b3f70ae753b45ca09c48de7d5fc4800e4836ad73 | |
parent | c6aa4b880ef84f671960ebcfd37237dc16b15936 (diff) | |
download | scilab_textbook_companion-27f39e80b66881dce2c66c30426efc83dae63ac1.tar.gz scilab_textbook_companion-27f39e80b66881dce2c66c30426efc83dae63ac1.tar.bz2 scilab_textbook_companion-27f39e80b66881dce2c66c30426efc83dae63ac1.zip |
fixed issue of search by student feature
-rwxr-xr-x | search.inc | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -155,24 +155,22 @@ function textbook_companion_browse_student() $return_html = _browse_list('student'); $return_html .= '<br /><br />'; $query_character = arg(2); - print $query_character; - die(); + //print $query_character; + //die(); if (!$query_character) { /* all books */ $return_html .= "Please select the starting character of the student's name"; return $return_html; } $book_rows = array(); - $query = "SELECT *, pro.id AS proposal_id, pre.id AS preference_id FROM textbook_companion_proposal pro LEFT JOIN textbook_companion_preference pre ON pro.id = pre.proposal_id WHERE full_name = '%s%'"; - $student_q = db_query($query); - while ($student_data = db_fetch_object($student_q,$query_character)) - { - $query = "SELECT * FROM textbook_companion_preference WHERE proposal_id = " . $student_data->proposal_id . " AND approval_status = 1"; - $book_q = db_query($query); - while ($book_data = db_fetch_object($book_q)) - { - $book_rows[] = array(l($book_data->book, 'textbook_run/' . $book_data->id), $student_data->full_name); - } + $student_q = db_query(" + SELECT po.full_name, pe.book as book, pe.author as author, pe.publisher as publisher, pe.year as year, pe.id as pe_id, po.approval_date as approval_date + FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id + WHERE po.proposal_status = 3 AND pe.approval_status = 1 AND full_name LIKE '%s%%' + ", $query_character); + while ($student_data = db_fetch_object($student_q)) + { + $book_rows[] = array(l($student_data->book, 'textbook_run/' . $student_data->pe_id), $student_data->full_name); } if (!$book_rows) { |