Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
請問這個PHP該怎麼寫
我想要一個可以從MYSQL的資料表裡亂數抽出英文單字或是其中文意思到頁面上
然後可以讓使用者做練習輸入,並評分
請問我要怎麼寫最簡單呢?
因為這只是我自已想要用來當做練習英文的工具,而我對PHP真的一點都不會。只會一些ASP的東西,請大家能給個提示或是要寫那些東西才
>< 謝謝大家!
2 Answers
- Anonymous2 decades agoFavorite Answer
首先你得有題目的資料表
就是哪些英文單字
然使用rand( )函數
你的資料筆數
$row_num = mysql_num_rows(...) ;
$val=rand(1,$row_num);
然後從資料庫中第$val筆相對應的其他欄位值
評分的部份就用form來處理囉
- 2 decades ago
把資料庫裡每個單字都配上一個鍵值(或序號),假如有一百個單字,
就從1-100中取亂數R,接著用SQL語法(亂數的函數請自己找)
"Select word from table where key = " + R
用+的關係是因為R是變數,所以要用+把其他固定不變的地方接起來。
由於不知道你的基礎有多少,所以也不曉得要講到多深,原理大概就是醬!
Source(s): 個人經驗