I have a database with UPC codes in it. I thought I could use LIKE in the MySQL statement to find an item but it doesn't return any items.
if($ndc != "") {
$ndc1 = substr($ndc, 1, -1);
$nc = "Select * FROM drug_info WHERE ndc like '%".$ndc1."%'";
} else {
$ndc1 = substr($ndc2, 1, -1);
$nc = "Select * FROM drug_info WHERE ndc like '%".$ndc1."%'";
}
$sql=mysql_query($nc) or die("ERROR!!!");
The UPC is 359930156012
The substr removes some whacky stuff in barcode so that it is the true NDC number (Sort of) 5993015601
The real NDC for this product is 59930156001 so I am in a bind would there be a better way to get this search??
Thx for any insight