Page 1 of 1

$PHP_SELF; hmmmmm

Posted: Wed Feb 26, 2003 10:29 am
by toms100
im trying to do this

Code: Select all

<?php



$db = mysql_connect("localhost", "root");

mysql_select_db("mydb",$db);

$result = mysql_query("SELECT * FROM employees",$db);

if ($myrow = mysql_fetch_array($result)) &#123;

  do &#123;

    printf("<a href="%s?id=%s">%s %s</a><br>\n", $PHP_SELF, $myrow&#1111;"id"], $myrow&#1111;"first"], $myrow&#1111;"last"]);

  &#125; while ($myrow = mysql_fetch_array($result));

&#125; else &#123;

  echo "Sorry, no records were found!";	

&#125;

?>
i have windows xp pro, installed php using the installer program on php.net, installed mysql using an installer program on its site.
but when i try to do echo $PHP_SELF; i get this error:
Notice: Undefined variable: PHP_SELF in E:\Tom\php work\index.php on line 17
can anyone help me here?
Thanks

Tom

Posted: Wed Feb 26, 2003 11:44 am
by EvilWalrus
You can do one of two thigns here:
  • - Update your php.ini file to have register_globals = true or...
    - Change $PHP_SELF to $_SERVER['PHP_SELF']

Posted: Wed Feb 26, 2003 11:54 am
by toms100
thanks for your very helpful reply
i changed to $_SERVER['PHP_SELF'] and its working fine

many thanks

Tom:)