note 104469 added to language.variables.scope
| From: | khanquered at gmail dot com | Date: | Thu, 16 Jun 2011 16:32:37 +0000 |
| Subject: | note 104469 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180617@lists.php.net to get a copy of this message | ||
Here is one example, how the 2nd function(thank_mssg) can access the variable $operation from the
first function(add_word).
keep in mind, that the variable has to be declare global in both function.
function add_word($_POST)
{ global $operation;
$eword = get_post('eword');
/// if words are presents than run this query
$d3000_query="do something with the DB";
$operation = mysql_query($d3000_query);
}
function thank_mssg(){
global $operation;
if($operation)
return ("thank you for adding a word");
else
{
return die(" Not working ) : ".mysql_error());
}
}
----
Server IP: 69.147.83.197
Probable Submitter: 99.9.188.9
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/104469
Del: integrated -- https://master.php.net/note/delete/104469/integrated
Del: useless -- https://master.php.net/note/delete/104469/useless
Del: bad code -- https://master.php.net/note/delete/104469/bad+code
Del: spam -- https://master.php.net/note/delete/104469/spam
Del: non-english -- https://master.php.net/note/delete/104469/non-english
Del: in docs -- https://master.php.net/note/delete/104469/in+docs
Del: other reasons-- https://master.php.net/note/delete/104469
Reject -- https://master.php.net/note/reject/104469
Search -- https://master.php.net/manage/user-notes.php