newbie question
| From: | Blake Schroeder | Date: | Tue, 24 Jun 2003 16:04:44 +0000 |
| Subject: | newbie question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-152632@lists.php.net to get a copy of this message | ||
I just setup php on my linux box and have been messing with a tutorial, and have had some issues.
The tutorial says any name=value pairs in the querystring "automatically creates a variable with the name and value the querystring indicated". This does not seem to be happening.
I have installed:
RedHat 9.0
Mysql 4.0.13
PHP 4.3.2
I have connected to databases, displayed info from database but cannot get data from the form into the database.
I have also not been able to get $PHP_SELF* to display anything.
Here is a sample code I have been using:
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
// display individual record
if ($id) {
$result = mysql_query("SELECT * FROM employees WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
printf("First name: %s\n<br>", $myrow["first"]);
printf("Last name: %s\n<br>", $myrow["last"]);
printf("Address: %s\n<br>", $myrow["address"]);
printf("Position: %s\n<br>", $myrow["position"]);
} else {
// show employee list$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF, $myrow["id"], $myrow["first"], $myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
</body>
</html>
Thanks for any help.
*--
Blake Schroeder
blake@lhwd.net