Jump to content


search help

  • Please log in to reply
No replies to this topic

#1 oMIKEo

  • Members
  • PipPip
  • Member
  • 19 posts
  • LocationLeeds, UK

Posted 23 April 2006 - 04:16 PM


Ive got a search page that im trying to code but cant work out how to do it...

the search terms are:

Pupil - this is the pupils id OR the the word ALL to display all pupils.

View - these are 4 different types of reports that can be searched, if selected their values are 'Y' the boxes are log, sen, lm, support.

Dates - these are a from and to dates stored as, from_day, from_month, from_year, to_day, to_month, to_year.

the database structure is:

DATABASE: rhr_report

r_id - auto_increment
p_id - pupil id (should link to rhr_pupils table, get the 'name' using the p_id info)
date - timestamp
type - either, log, sen, lm, support.

How do you get it to display the table info from rhr_report and the pupils name from the rhr_pupils table based on what the user selects out of the terms?

If they select ALL then it would need to display all the records based on 'dates' and the 'view'.

So far ive got:
                    $pupil= $_POST['pupil'];
                    $log= $_POST['log'];
                    $sen= $_POST['sen'];
                    $lm= $_POST['lm'];
                    $support= $_POST['support'];
                    $from_day= $_POST['from_day'];
                    $from_month= $_POST['from_month'];
                    $from_year= $_POST['from_year'];
                    $to_day= $_POST['to_day'];
                    $to_month= $_POST['to_month'];
                    $to_year= $_POST['to_year'];
                    $conn=mysql_connect("$db_host","$db_username","$db_password") or die("Err:Conn");
                    $rs = mysql_select_db("$db_main",$conn) or die("Err:Db");
                    $sql="select * from rhr_report where p_id='$pupil'";
                    $rs=mysql_query($sql,$conn) or die("Could not execute query");
                        echo ''.$row['p_id'].'<br />';
                        echo ''.$row['date'].'<br />';
                        echo ''.$row['author'].'<br />';
                        echo ''.$row['type'].'<br />';
                        echo nl2br (''.$row['notes'].'');
Any help would be appreciated.

Thank, Mike

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users