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);
?>