$result = mysql_query("SELECT * FROM marias_products WHERE product_id = $id ");
$projects = array();
while($rowrow = mysql_fetch_assoc($result)){
$projects[] = $rowrow;
}
foreach ($projects as $project) {
$resultq = mysql_query("SELECT * FROM inventory WHERE product_id LIKE '%".$id."%'");
while($rows = mysql_fetch_array($resultq))
{
$qwerty=$rows['qtyleft'];
}
if ($qwerty!=0)
{
// echo '<input type="text" name="pizasize" value="'.$project['product_size_name'].'"/>';
echo '<input hidden type="text" name="idd" value="'.$project['mp_id'].'"/>';
echo '<tr>';
echo '<td>'.$project['product_size_name'].'</td>';
echo '<td>'.$project['product_price'].'</td>';
echo '<td>'.$project['mp_id'].'</td>';
echo '<td>'.'<input name="but" type="image" value="'.$project['mp_id'].'" src="images/button.png" />'.'</td>';
echo '</tr>';
}
else
{
echo 'not available';
}
}
在foreach循环中获取选定的'mp_id
'时遇到问题。发生的事情是,一旦我单击按钮选择。我选择了整个表格的最后一个ID。希望有人可以帮忙。泰只是学习PHP。