AnsweredAssumed Answered

Special Character in PHP

Question asked by TimRycroft on Jun 30, 2013
Latest reply on Jul 2, 2013 by jmw


Special Character in PHP

Your post


     Hi, I've writted a bit of code after googling which basically looks up the database I have for a job number and email address. This works fine, I just need to do a little more formatting on the HTML side of things. The problem I'm having is if you enter a tim* in the email address field then this wil search for every tim in my database. How do I stop the special character's? I've tried a few different approaches but it never seems to work. 
     require_once 'FileMaker.php';
     include 'includes/dbaccess_asset.php';
     echo $output;
     $type = $_GET['SRNumber'];
     $subject = $_GET['Email'];
     $skip = $_GET['skip'];
     if(!isset($skip)) { $skip = 0; }
     $max = 500;
     $searchstring = "SRNumber=$type&Email=$subject";
     $findCommand =& $fm->newFindCommand('Service Reports');
     $findCommand->addFindCriterion('SRNumber','=='.$type. '"');
     $findCommand->addFindCriterion('Email','=='.$subject. '"');
     $findCommand->setRange($skip, $max);
     $result = $findCommand->execute();
     if (FileMaker::isError($result)) {
         echo "Error: " . $result->getMessage() . "\n";
     $records = $result->getRecords();
     $found = $result->getFoundSetCount();
     $prev = $skip - $max;
     $next = $skip + $max;
     if(($skip + $max) > $found) {$next = $skip; }
     <title>Custom Web Publishing</title>
     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     <table border="1">
     foreach ($records as $record) { ?>
     <td><?php echo $record->getField('SRNumber'); ?></td>
     <td><?php echo $record->getField('Email'); ?></td>
     <td><?php echo $record->getField('Description'); ?></td>
     <td><?php echo $record->getField('Job Status'); ?></td>
     <?php } ?>
     <a href="<?php echo "?skip=$prev&$searchstring"; ?>">Previous</a> | <a href="<?php echo "?skip=$next&$searchstring"; ?>">Next</a>