我有一个填充了数据库中数据的html选择。 看起来像这样
#!/bin/bash
sum=0
count=1
read -p "Enter A Grade Point: " grade
while (( $(echo "$grade != 99" | bc) ))
do
count=$(( count + 1 ))
sum=$(echo "scale=2;($sum+$grade)" | bc)
read -p "Enter A Grade Point: " grade
done
avg=$(echo "scale=2;($sum/$count)" | bc)
if (( $(echo "$avg 4" | awk '{print ($1 < $2)}') )); then
echo "Your GPA is $avg"
echo "This is an B!"
elif
(( $(echo "$avg 3" | awk '{print ($1 < $2)}') )); then
echo "Your GPA is $avg"
echo "This is a C!"
elif
(( $(echo "$avg 2" | awk '{print ($1 < $2)}') )); then
echo "Your GPA is $avg"
echo "This is a D!"
elif
(( $(echo "$avg 1" | awk '{print ($1 < $2)}') )); then
echo "Your GPA is $avg"
echo "This is a F!"
else
echo "Your GPA is $avg"
echo "This is a A!"
fi
exit 0
下面我有一个表格,其中填充了数据库中的值。
echo '<select name="client_list">';
foreach ($htmlselect as $key => $row) {
echo
'<option value='.$row->CUSTOMERCODE.'>'
.$row->CUSTOMERNAME. '</option>';
}
echo '</select>';
现在在这个查询中我想添加到另一个条件,从html选择中获取所选选项值
它看起来像这样
$table = $wpdb->get_results('SELECT STRING, DATE, STRING02 FROM `CUSTOMERFILE` WHERE `code` = 2 AND `status` = 2');
echo '<thead ><tr >';
foreach ($header as $list) {
echo '<th >' . $list . '</th>';
}
echo "<thead></tr>";
if ( !empty( $table) ) {
foreach ( $table as $key => $value ) {
echo '<tr >';
foreach ( $value as $a ) {
if (empty($a)) {
# code...
echo '<td>NULL</td>';
} else {
echo '<td>' . $a . '</td>';
}
}
echo '</tr>';
}
}
如何在查询中传递所选值?
答案 0 :(得分:0)
getTagValue(strResponse, "firstname ")
public static String getTagValue(String xml, String tagName){
return xml.split("<"+tagName+">")[1].split("</"+tagName+">")[0];
}
函数有2个参数,第一个是查询,第二个是输出
$wpdb->get_results()