OS: win2k
Server: httpd
phpver: 4.0.2
DB: Mysql (fresh download)
The code below I got from a PHP tutorial at WebMonkey.
The process of bringing up the list of names on first pass is very
fast. The process of bringing up the edit form is very fast at
displaying info from server.
The problem comes in where the update happens. This is very very
slow. Now I can't see that this would be a php problem (i have posted
similar question on httpd news list) but my question is there anything
in php which could cause a 20-30 second delay?
I have 'inserted' 5000 records from command line into mysql and all
5000 records only took 5 seconds. So it doesn't "look" like a server
problem. Could it be a very *bad* odbc driver?
tia
DSig
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
if ($id) {
if ($submit) {
$sql = "UPDATE employees SET
first='$first',last='$last',address='$address',position='$position' WHERE id=$id";
$result = mysql_query($sql);
echo "Thank you! Information updated.\n";
} else {
// query the DB
$sql = "SELECT * FROM employees WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type=hidden name="id" value="<?php echo $myrow["id"] ?>">
First name:<input type="Text" name="first" value="<?php echo
$myrow["first"] ?>"><br>
Last name:<input type="Text" name="last" value="<?php echo $myrow["last"]
?>"><br>
Address:<input type="Text" name="address" value="<?php echo
$myrow["address"] ?>"><br>
Position:<input type="Text" name="position" value="<?php echo
$myrow["position"] ?>"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
}
} else {
// display list of employees
$result = mysql_query("SELECT * FROM employees",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF,
$myrow["id"], $myrow["first"], $myrow["last"]);
}
}
?>
</body>
</html>