Hi Guys....
I'm totally new to PHP, learnt it yesterday as a matter of fact...well not really learnt...just looked up some php syntax. I've had previous experience with ASP and SQl server. Anyways, I'm having trouble with one of my php pages...what it does is read all the users from my mysql db and echo them in to a table using a while loop. With this page, I also have a button next to every name so that I can delete the users from the db.
The page I will be talking about is found here: http://web.aanet.com.au/david/fresh/admin/del.php
Bascially I'll give you an idea of what the page goes through in terms of code.
$query="SELECT * FROM freshminds";
$result = mysql_query($query,$mysql_link);
From the results of that sql query, I get every single person found in the db and write it to the page in table format.
Next to each name on the page is an ordinary html submit button...whose name attribute is called submit. When it is pressed, a javascript msg box prompts the user to confirm deletion of the user from the db.
To this button, I assign the html attribute value to the users' userId from the db, so that when I click the button, I know what user I am dealing with when the form is processed. The form is sends all this information from del.php to the processing page del2.php where all the deleting code is found. userId is a field in the table freshminds. It is my primary key and thus auto-incremented.
The main guts of del2.php is as following
$queryselect="SELECT * FROM freshminds WHERE userId='$_POST[submit]'";
$querydelete="DELETE FROM freshminds WHERE userId='$_POST[submit]'";
$result = mysql_query($queryselect,$mysql_link);
$row = mysql_fetch_array($result);
$name = $row['firstname']." ". $row['surname'];
mysql_query($querydelete,$mysql_link);
echo "The user ".$name." was deleted.<br><br>";
echo "<a href=\"del.php\">Delete another user</a>";
(By the way, if there are no users in the database, just add some using http://web.aanet.com.au/david/fresh/admin/add.php)
Now here comes the problem...Whilst it works fine in firefox...it does not for Internet Explorer...any ideas? Now if you try it in IE, del2.php echoes to the page "User so and so was deleted." Meaning that it should have run the SQL statement found in the variable $querydelete. So the question becomes, why doesn't this delete sql statement execute in IE, yet run fine in firefox. Here's where my thinking is at at the moment, and correct me if I am wrong; the SQL statement MUST execute if programs when compiled run line by line. If it didn't run or had syntax problems, the compiler would return an error and stop compiling the page.
Also, another problem that is encountered in IE, but not in firefox is the following.
echo "The user ".$name." was deleted.<br><br>";
echo "<a href=\"del.php\">Delete another user</a>";
IE does not print out the variable $name, where $name = $row['firstname']." ". $row['surname']; Yet firefox prints out the name of the user deleted. The variable $name is definately set before the delete sql statement is run...meaning that the record of the user i want to delete is still in the db.
Any ideas?