Hi all,
I open the cmd prompt and run a php script and it works. Ex: php script.php
I was hopeful I could use the querystring parameter Ex: php script.php?var1=A&var2=B
But I get: Could not open input file: ExtractOneDatabase.php?dbid=5
Is there a way to do this? Or do I need to pass parameters via an input file when run locally?
Thanks,
Mat
Running php code locally passing parameters not working
Moderator: General Moderators
Re: Running php code locally passing parameters not working
So far I have found:
var_dump($argv);
var_dump($argv);
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Running php code locally passing parameters not working
Yes $argv will give you the parameters that were passed. If you want to use the query string as you have shown then you would do something like:
[text]php script.php var1=A&var2=B[/text]
[text]php script.php var1=A&var2=B[/text]
Code: Select all
parse_str($argv[1]);mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.