I have the following query and i want to run the whole table in order to give me one-by-one each value of the table. I need that to use the specific row value in another query.
for ($qoffset=0; $qoffset<=5; $qoffset++) {
$result = mysqli_query($con,"select nf865_virtuemart_products.product_sku from nf865_virtuemart_products order by product_sku asc limit 1 offset '".$qoffset."';");
echo "offset='$qoffset' <br>";
while($row = mysqli_fetch_array($result,MYSQLI_BOTH)) {
echo $row[0];
echo "<br>";
}
What i get is "Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given"
It seems i get a boolean(false) as a result, the query works fine if a place a number instead of a variable.
Any help on this please?
Further sql:
mysqli_query($con,"Insert Ignore Into nf865_virtuemart_product_medias(virtuemart_product_id,virtuemart_media_id,ordering) VALUES (
(Select nf865_virtuemart_products.virtuemart_product_id from nf865_virtuemart_products where nf865_virtuemart_products.product_sku LIKE '0100100'),
(Select nf865_virtuemart_medias.virtuemart_media_id from nf865_virtuemart_medias
where nf865_virtuemart_medias.file_url LIKE '%0100100 b.jpg' or nf865_virtuemart_medias.file_url LIKE %0100100 B.jpg'),2)");
what i tried but didn't worked yet:
$query1 = mysqli_query($con,"Select nf865_virtuemart_products.virtuemart_product_id from nf865_virtuemart_products where nf865_virtuemart_products.product_sku LIKE '".$product_id."'");
It needs to be like this '$variable' somehow because it returns nothing as i can see.