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;
Edited by wkilc
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.