How to use multiple search keys?
        Posted  
        
            by 
                user32565
            
        on Pro Webmasters
        
        See other posts from Pro Webmasters
        
            or by user32565
        
        
        
        Published on 2013-11-06T09:28:22Z
        Indexed on 
            2013/11/06
            10:12 UTC
        
        
        Read the original article
        Hit count: 283
        
I have a database wherein the files are named abcd100.00b, abcd101.00b, etc. I need a code where when the user enters abcd separate then 100 to 110, all the files with the name abcd and in the range 100 to 110 should get displayed now the following code can display only the first four characters.
How do I implement this?
    <?php
//capture search term and remove spaces at its both ends if the is any
         $searchTerm = trim($_GET['keyname']) ;
//check whether the name parsed is empty
         if($searchTerm == "rinex_file")
         {
           echo "Enter name you are searching for.";
           exit();
          }
          if($searchTerm == "rinex_file")
         {
          echo "Enter name you are searching for.";
          exit();
          }
//database connection info
        $host = "localhost"; //server
        $db = "rinex"; //database name
        $user = "m"; //dabases user name
        $pwd = "c"; //password
//connecting to server and creating link to database
        $link = mysqli_connect($host, $user, $pwd, $db);
//MYSQL search statement
        $query = "SELECT * FROM rinexo WHERE rinex_file LIKE '%$searchTerm%'";
         $results = mysqli_query($link, $query)  ;
/* check whethere there were matching records in the table
by counting the number of results returned */
         if(mysqli_num_rows($results) >= 1){
         echo '<table border="1">
         <tr>
         <th>rinex version</th>
         <th>program</th>
          <th>date</th>
         <th>maker name</th>
         <th>maker number</th>
          <th>observer</th>
          <th>agency</th>
         <th>position_X_Y_Z</th>
          </tr>';
         while($row = mysqli_fetch_array($results)){
         echo '<tr>
         <td>'.$row['rinex_version'].'</td>
         <td>'.$row['pgm'].'</td>
          <td>'.$row['date'].'</td>
          <td>'.$row['marker_name'].'</td>
            <td>'.$row['marker_no'].'</td>
             <td>'.$row['observer'].'</td>
            <td>'.$row['agency'].'</td>
          <td>'.$row['position_X_Y_Z'].'</td>
         </tr>';
           }
         echo '</table>';
          }else{
           echo "There was no matching record for the name " . $searchTerm;
            }
© Pro Webmasters or respective owner