比方說,我有以下幾點:從響應狀態獲取行號
$variable = SELECT * FROM `accounts` order by `creation_date`
賬目表保存:
| id | username | creation_date | ...
如果$variable
輸出以下:
響應:
| id | username | creation_date|
| 2 | bob | 1 |
| 4 | jesus | 2 |
| 8 | vanessa | 4 |
| 5 | user1 | 43 |
在這個Jesus
之前,真正獲得$ variable中發生的行數是一個好方法嗎?在這種情況下,執行查詢時將是第二行。
我確實知道其他方法,比如做一個foreach
並檢查每個人的jesus
,但我希望有更好的解決方案呢?
我打算在每個頁面上刷新,執行此查詢並查找人員行。所以foreach/while循環會不會很慢?
SELECT * FROM'accounts'其中username = '耶穌' – splash58
@ splash58但我不從spesific查詢得到它的行... – maria
我不不明白 - 你想按序列號排列嗎? – splash58