Hi,
I got database table that contains product code, and also I got an array of product code before doing any thing I want to check either that product code exists in database table or not. How can I do thins ?
Thanks
Searchin DB table
Moderator: General Moderators
-
devendra-m
- Forum Contributor
- Posts: 111
- Joined: Wed Sep 12, 2007 3:16 am
thats quite simple
lets say u have array of product codes $prd_arr
get the array of product codes from database suppose $prd_db
now further codes
lets say u have array of product codes $prd_arr
get the array of product codes from database suppose $prd_db
now further codes
Code: Select all
function checkExists($prd_arr,$prd_db)
{
foreach($prd_arr as $key=>$value)
{
if(!in_array($value,$prd_db))
return false;
}
return true;
}