windows7
IIS version 6.1
php script not running in IIS
.Works however in xampp
Can someone please help
------------try1.php-------------
<html>
<body>
<?php
$db = mysql_connect("localhost", "root","sada");
mysql_select_db("naradb",$db);
if(isset($_POST['submit'])) {
// here if no ID then adding else we're editing
if (isset($id)) {
$sql = "UPDATE employees SET first='$first',last='$last',email='$email',phone='$phone' WHERE id=$id";
} else {
$sql = "INSERT INTO employees (first,last,email,phone) VALUES ('$first','$last','$email','$phone')";
}
// run SQL against the DB
$result = mysql_query($sql);
echo "Record updated/edited!<p>";
printf("<A HREF=\"try1.php\"> main</A> ");
}elseif(isset($delete)) {
// delete a record
$sql = "DELETE FROM employees WHERE id=$id";
$result = mysql_query($sql);
echo "$sql Record deleted!<p>"; printf("<A HREF=\"try1.php\"> main</A> ");
} else {
// this part happens if we don't press submit
if(empty($id)) {
// print the list if there is not editing
echo "Click on name to get details to update,<br>[x] to delete entry.<p>";
$result = mysql_query("SELECT * FROM employees",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href=\"%s?id=%s\">%s %s</a> \n", $_SERVER['PHP_SELF'], $myrow["id"], $myrow["first"], $myrow["last"]);
printf("<a href=\"%s?id=%s&delete=yes\">[x)</a><br>",$_SERVER['PHP_SELF'], $myrow["id"]);
}
}
?>
<P>
<a href="<?php echo $_SERVER['PHP_SELF']?>">ADD A RECORD</a>
<P>
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
mysql_select_db("naradb",$db);
if (isset($id)) {
// editing so select a record
$sql = "SELECT * FROM employees WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$first = $myrow["first"];
$last = $myrow["last"];
$email = $myrow["email"];
$phone = $myrow["phone"];
// print the id for editing
?>
<input type=hidden name="id" value="<?php echo $id ?>">
<?php
}
?>
<TABLE BORDER="2" BORDERCOLOR=#9CCFFF WIDTH="100%" bgColor=#cccfff>
<TR><TD WIDTH="30%" VALIGN=TOP> <FONT face=Arial,Helvetica size=2>
name:<BR><?php echo $myrow['last']; ?> <BR><?php echo $myrow['first']; ?>
<TD WIDTH="35%" VALIGN=TOP><FONT face=Arial,Helvetica
size=2>email & phone<BR><?php echo $myrow['email']; ?><BR><?php echo $myrow['phone']; ?><BR>
</TD></TR></TABLE>
<BR>
First name:<input type="Text" name="first" value="<?php echo $first ?>"><br>
Last name:<input type="Text" name="last" value="<?php echo $last ?>"><br>
email:<input type="Text" name="email" value="<?php echo $email ?>"><br>
phone:<input type="Text" name="phone" value="<?php echo $phone ?>"><br>
<input type="Submit" name="submit" value="Enter information">
</form><BR><A HREF="try1.php"> main</A>
<?php
}
?>
</body>
</html>