View Single Post
  #2 (permalink)  
Old July 30th, 2008, 04:13 AM
andychamberlainuk andychamberlainuk is offline
Registered User
 
Join Date: Jul 2008
Location: Leeds, , United Kingdom.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I've got a few pointers for you. Firstly, if you change your queries to this, it will show you any errors in your query.

e.g. $result = mysql_query($sql) or die(mysql_error());

Now, as you your code, I'll put it in order:

1) Refresh problem
If you move all the processing PHP code to the top of the page before the HTML, you can run all the queried before you know there is a problem (e.g. duplicate). Add the following code (+ braces after)

if (isset($_POST['submit']))
{
    //form processing here
}

2) Delete user blank page
Ok, here I think you are using the variable $id with regiser_globals turned off. Maybe change it to: -

if (is_numeric($_GET['id']))
{
    //other validation to prevent hackers
    $id = $_GET['id'];
} else {
    die("Error");
}
3) Query
Try $sql = "SELECT * FROM students";

This way, you can load all the fields from students.

Hope this helps

Reply With Quote