how does one search mysql where one fields has multiple entries.

example:

in my db i have two fields in table, one field is the type field:
id | Garment | Type
1 | Satin Shirt | "Chemical Clean"
2 | Silk Shirt | "Dry Clean", "Chemical Clean"


When i search for say Chemical clean i want it to show the two reords
When I serach for dry clean only the dryclean must show
Have tried several methods, is there a way i could make something that could break the type field appart, and look in teh field if the criteria matches.

<?php

require_once('db_conf.php');

$sql = "SELECT * FROM tbl_product where fld_type=$type"

$result = mysql_query($sql);		
while($row = mysql_fetch_assoc($result)){

echo "Product ID:'".$row['id']."' - ".$row['fld_type']."";
}
?>

Recommended Answers

All 2 Replies

$sql = "SELECT * FROM tbl_product where fld_type like '%{$type}%'";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.