Jump to content

blackdog

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

blackdog's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So if I understand correctly that is the specific command to bring back any names starting with Fr right? How do I set that up so that it does that with whatever is put in as the search criteria? Since it won't always be names beginning with Fr...I might be searching for patients with last names starting with St or S. I'm really new to php and SQL so I may be asking a dumb question. I guess part of my problem is that I don't understand what the variable '%s' is or where it comes from. I don't see it defined anywhere in my code. I think that if I understood how dreamweaver comes up with that variable I might be able to wrap my mind around it a little better.
  2. An example would be that in this database I have a patient with the last name of Frost. If I search for "Frost" in my search form field it brings up his record. What I am looking to do is be able to search for "Fr" and have it bring up any record which matches the "Fr" so maybe it brings up Frost and also Frasier because the both start with the "Fr". Another example would be wanting to just bring up all records that start with the letter "F" by simply searching for "F" instead of a complete name. Does that help? If you need me to provide anything else, let me know. Thanks for your help.
  3. I tried changing th = to LIKE and it still only returns exact matches. Any other ideas?
  4. I am trying to create a search function that can return results that don't necessarily match the search exactly. I have created the following mySQL query using dreamweaver 8 which only returns results that match the search exactly. Can anyone help me with this? Here is the code that I/Dreamweaver have created (I am using mySQL v. 4.1.22): <?php $colname_rsPtInfo = "-1"; if (isset($_POST['Search'])) { $colname_rsPtInfo = $_POST['Search']; } $colname_rsPtInfo = "-1"; if (isset($_GET['Search'])) { $colname_rsPtInfo = (get_magic_quotes_gpc()) ? $_GET['Search'] : addslashes($_GET['Search']); } mysql_select_db($database_corys, $corys); $query_rsPtInfo = sprintf("SELECT * FROM PtInfo WHERE Last_Name = '%s' ORDER BY Last_Name ASC", $colname_rsPtInfo); $rsPtInfo = mysql_query($query_rsPtInfo, $corys) or die(mysql_error()); $row_rsPtInfo = mysql_fetch_assoc($rsPtInfo); $totalRows_rsPtInfo = mysql_num_rows($rsPtInfo); ?>
×
×
  • 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.