如何进行简单的PHP基础测验

I want to make 15 questions, and any time user visits the page it shows random 5 questions and each question has 4 answers and 1 is the correct. The marks are 20, 15, 10 and 0.

How can i make it?

Ok well nobody is going to write the full code for you I think, but as a general schema design, you'd want something like this...

questions table (q_id, q_question)
questionoptions (qo_optionid, qo_questionid, qa_option)
useranswers (ua_userid, ua_questionid, ua_optionid)

To get the choices for a given question (question 1 lets say)

select 
  * 
from 
  questions 
  inner join questionoptions on (qo_questionid = q_id) 
order by 
  qo_optionid

To get a report of the options each user chose...

select 
  * 
from 
  questions 
  inner join questionoptions on (qo_questionid = q_id) 
  inner join useranswers on (ua_questionid = q_id and ua_optionid = qo_optionid) 
order by 
  ua_userid, ua_questionid

Note that im not advocating the use of SELECT *, but its there for simplicity of example.

I always find it best to start learning by Googling for tutorials.

Here are a few:

I'm sorry to tell you go Googling, but I think the tutorials and examples you'll find there, will be far more helpful to you than any answer here on StackOverflow.