Jump to content

return exact room number


wkilc

Recommended Posts

If I query my database:

www.mydomain.com/index.php?room=M210

 

I get both room M201 and M210B in my results.

 

I know enough to know that is a result of:

   and (allstate_schedule.room LIKE '$room%')

So I change it to this:

   and (allstate_schedule.room LIKE '$room')

Now the query works correctly:

www.mydomain.com/index.php?room=M210

 

But if I pull up an unfiltered list:

www.mydomain.com/index.php

 

... I get my "No records found matching:"

 

here is my code:


 $query =
        "SELECT allstate_schedule.sponsor,allstate_schedule.school,allstate_schedule.student,allstate_schedule.instrument,allstate_schedule.school,allstate_schedule.room,allstate_schedule.time
        from allstate_schedule
        WHERE ((allstate_schedule.sponsor LIKE '$sponsor%')
      and (allstate_schedule.student LIKE '%$student%')
   and (allstate_schedule.instrument LIKE '$instrument%')
   and (allstate_schedule.school LIKE '$school%')
   and (allstate_schedule.room LIKE '$room%')
   and (allstate_schedule.time LIKE '$time%'))
        ORDER BY allstate_schedule.$sort LIMIT $eu, $limit ";
$resultt = mysql_query($query);

// Determine the number of employees
$number = mysql_num_rows($resultt);

if ($number == 0) {
   print "<b>No records found matching</b>:";

$sponsor = $sponsor;
$school = $school;
$room = $room;
$student = $student;
Link to comment
https://forums.phpfreaks.com/topic/292363-return-exact-room-number/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.