lawrence_dev
asked on
Need assistance with PHP PDO SELECT inside a WHILE
I need assistance on how to set up a SELECT within a WHILE. How do I do this
Variable from import is $data[0]. (SKU)
Another table has Prohibited_SKU.
Desired result:
IF prohibited_sku === $data[0] then $googleprohibited="1"
ELSE
googleprohibited="0"
Variable from import is $data[0]. (SKU)
Another table has Prohibited_SKU.
Desired result:
IF prohibited_sku === $data[0] then $googleprohibited="1"
ELSE
googleprohibited="0"
$filename="http://website.com/feeds/productdownload.php?id=MPB&version=2&format=csv&fields=sku&time= . $time . ";
//open the file
$handle = fopen($filename, "r");
//this is what causes it to skip
fgetcsv($handle,",");
//begin looping through the lines
while (($data = fgetcsv($handle, ",")) !== FALSE)
{
// loop all column values and escape special characters
foreach ($data as $key => $value){
$data[$key] = $value;
}
//echo $data[0];
$query = $conn->query('SELECT DISTINCT `prohibited_sku` FROM `Google_Prohibited_Skus` WHERE `prohibited_sku` === $sku');
while ($row100 = $query->fetch(PDO::FETCH_ASSOC))
{
if ($row100[prohibited_sku] === $sku) {
$googleprohibited="1";
} else {
//$googleprohibited="0";
}
}
echo $googleprohibited." <BR>";
//INSERT HERE
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.