cottonbuds2005 Posted October 16, 2009 Share Posted October 16, 2009 Please bear with me because Im a newbie at SQL / PHP stuff. My database is an inventory of all our PC equipment. What I want to do is make a search for a serial number with wildcard strings at the end. example: when I enter the serial number LVW9 I want the results for all PCs having sn starting with that string. Like LVW9237, LVW9228 etc etc The code below allows just the exact sn for the PC. How to do this? Please help me. ___________________________________________ mysql_select_db($database_ITInventory, $ITInventory); $query_SearchSerial = sprintf("SELECT * FROM assetsdb WHERE SerialNo = %s", GetSQLValueString($colname_SearchSerial, "text")); $SearchSerial = mysql_query($query_SearchSerial, $ITInventory) or die(mysql_error()); $row_SearchSerial = mysql_fetch_assoc($SearchSerial); $totalRows_SearchSerial = mysql_num_rows($SearchSerial); Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi To use wild cards use a LIKE instead of an =, and then use the appropriate wild card for your search (ie, % for zero or more characters, _ for a single character, etc). All the best Keith Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.