[英]PHP, MySQL - only getting the last entry
我正在嘗試調整我沒有編程的現有 Web 應用程序。 這是使用此 Web 應用程序的用戶不滿意的功能。 到目前為止,我已經設法做它應該做的事情,但我的問題是,當我添加帶有以下號碼的新客戶並嘗試編輯舊條目時,我只能得到已添加的最后一個條目。 我試過使用 $this。 但我沒有幫助。 所以我的問題是如何讓 php 查看與客戶 ID 對應的條目,而不僅僅是查看添加的最后一個條目。
//set the query and fetch data from it
$resnew = mysql_query("SELECT * FROM orders");
while ($dnew=mysql_fetch_assoc($resnew)) {
$number = $d['number'];
$auto_id = $d['auto_id'];
$modell = $d['modell'];
}
//set the other query to fetch data from it
$reslevel=mysql_query("SELECT level FROM modells WHERE auto_id=$modell");
while ($dlevel=mysql_fetch_assoc($reslevel)) {
$parameter="level";
$$parameter=$dlevel["$parameter"];
}
?>
<li> //Output
<label><? echo $label ?>:</label>
<input type="text"
name="<? echo $settings_id ?>_settings_one_rule"
maxlength="<? echo $lenght ?>"
class="textfeld"
style="width:<? echo $should_lenght ?>px;"
value="<?
if ($settings_id == 12) {
echo "$number . $level ;
}
?>"
>
</li>
這是你目前的邏輯:
顯然,你只會得到最后一部分。
移動循環內的輸出。
那么你的邏輯將是:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.