I want to input id number and date as command line arguments for a pHP script that sends query to the database.
I am using a version PHP/4.2.2
My script starts as follows:
<?php
$num_args= $SERVER['argc'];
$argv= $SERVER['argv'];
echo $argc"\n";
echo $argv[0];
Then I have my query script etc
?>
it is stored in script.php.
Then when I run my code in linux command line,
php script.php 2 1 '2004-01-28%'
I get the following error.
PHP Notice: Undefined index: argc script.php on line 3
PHP Notice: Undefined index: argv script.php on line 4
How should I correct this?
Thanks,
balaji.