Help with a PHP Quiz

Can somebody help me out with a beginners PHP Quiz for School?

“Use the information below to finish the input form. The user should be able
to add a new name and email record into the account table and display
the 10 newest records below the form.”

I have caught the increment typo and I think I got the form action. Is there anything I am missing? How do I get the 10 newest records to show below the form?

Thanks

[php]
class account{

function account(){
$this->id = ’ ';
$this->name = ";
$this->email = ";
}

function find_account($id){
$sql=“select ‘id‘ from ‘account‘ where ‘id‘=’”.$id."’";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$row[‘id’]; //int pk auto incerment increment
$row[‘name’]; //varchar(50)
$row[‘email’]; //varchar(50)
$row[‘timestamp’]; //varchar(15)
}
}
}
[/php]

<htm|>
<body>
<div>
 <form action='#'>  [b]<form action="#" method="post">[/b]
      name: <input type='text' name='account_name'>
      email:<input type='text' id='account_email'>
           <input type="button" value="submit">
    </form>
</div>
<div style="border:solid 1px #F6O;">
Last 10 entry:
</div>
<div style="border:solid 1px #OOO;">
<?php echo "id: ".$account->id;?>
<?php echo "name: ".$account->name;?>
<?php echo "email: ".$account->email;?>
</div>
</body>
</htm|>

I don’t see where you are attempting to do either of the things asked.

“The user should be able to add a new name and email record into the account table”

Here you will have to POST the form and input the $_POST variables into the database via INSERT query.

“display the 10 newest records below the form”

Here you will have to query the accounts table using ORDER BY and LIMIT. Then echo the results.

You have to make an attempt to get help, especially considering this is for a class :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service