I have the following bit of code:
$query = "SELECT * FROM jos_vm_product_details WHERE global_variant_id = '$global_variant_id'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
$row['name'];
}
Is it possible to select the $row[‘name’] only where something is matched:
Select $row['name'] WHERE id = $id
Any help would be appreciated
I don’t fully understand your question, but you can limit that in the query to begin with:
Otherwise if you need to limit it in the fetch loop, use something like:
But this is better handled in the query’s
WHEREclause as in my first example.