In PHP I am having difficulty trying to extract row data from one SQL Query results. The service information I require is stored in an array called $SelectedItems. The Code below works as it should but Prints the Entire table with all rows. How would I get it to simply print the 1 row.
$sql ="select blah blah"
//Output result
$result = mysql_query($sql);
//Generate Information about Service or Product
while($row = mysql_fetch_array($result))
{
if (in_array($row['Service_Name'], $SelectedItems)){
print $row['Service_Description'];
print $row['Service_Cost'];
}
};
I am pretty new to PHP and might be going about this in the wrong way please let me know if im being back to front lol.
The $SelectedItems are processed from $_POST Data and the required data is set into an array
//Finds Out which services have been selected
foreach (array_keys($_POST) as $key) {
$$key = $_POST[$key];
if ($$key == "1"){
print "$key is ${$key}<br />";
$SelectedItems[] = $key;
};
};