creating a global variable with php

Ads
 

creating a global variable with php

Is it possible to create a variable to declare as global in case of database connectivity?

View Answers

September 17, 2011 at 12:22 PM

Yes, if you want to have access of that variable anywhere in the program. See the example below..

function processlogin($username, $password){
    global $database;
    $database->login($username, $password);
}

Ads









Related Tutorials/Questions & Answers:
creating a global variable with php
creating a global variable with php  Is it possible to create a variable to declare as global in case of database connectivity?   Yes, if you want to have access of that variable anywhere in the program. See the example
global variable in objective c
global variable in objective c  Declaring global variable in objective c
Advertisements
variable function in php
variable function in php  Can any one tell me how to write a variable function in PHP?   Go through the PHP Variable function tutorial ... PHP Variable Function
variable function in php
variable function in php  Can any one tell me how to write a variable function in PHP
if variable is null php
if variable is null php  How to check if submitted variable is null in PHP? Thanks!   Check if Variable is NULL in PHP You can use isset($var) to check if the variable is not defined or null in PHP. and after setting
Create Session Variable PHP
Create Session Variable PHP  hi, Write a program which shows the example of how to create session variable in PHP. Please suggest the reference... session Variable in PHP. May be this reference will solve your query. Thanks
I want to store the value of local variable into Global variable
I want to store the value of local variable into Global variable    <%=cnt%>=x; is it a valid Statement
setting php session variable by ajax
setting php session variable by ajax  Hello folks, i developing a php website where the content of the section load dynamically from database... tried to use AJAX to call another PHP script to set the session variable
PHP SQL Variable
PHP SQL Variable       PHP SQL Variable are denoted with a leading dollar sign ($). The PHP ... illustrates how to create the variable in php for sql operation. In this example
Php Sql Variable
Php Sql Variable This example illustrates how to create the variable in php for sql operation. In this example we create a variable $con for mysql connection and $update for query. The sign ($) is used to create the variable in php
How to Creating Pop Up Menu in PHP?
How to Creating Pop Up Menu in PHP?  Hi, I am a beginner in the PHP Application. Can somebody give an example of how to creating pop up Menu in PHP. Please feel free to suggestion........ Thanks
Creating Array in PHP
and creating an Array in PHP. Basically an Array could be of three different types... by an Array. Now let?s take an example of creating an Array in PHP Always... pieces of information within it. Creating an array is extremely easy. It takes
Get Variable in PHP Video tutorial
In this tutorial you will learn to use GET variable in PHP with the help... GET variable in PHP as the tutorial has been described with simple example... to use the GET variable in PHP you should know that, basically there are two
Creating a Local Variable in JSP
Creating a Local Variable in JSP     ...;TITLE>Creating a Variable in Jsp</TITLE> </HEAD> <BODY> <H1>Creating a Variable in jsp</H1> <
Creating a Local Variable in JSP
Creating a Local Variable in JSP     ...; <HEAD> <TITLE>Creating a Variable in Jsp</TITLE> </HEAD> <BODY> <H1>Creating a Variable
Predefined Variable in PHP
In order to create more complex and dynamic web applications, PHP offers.... These predefined variables in PHP ensure the security of applications from external... there are a huge list of predefined variables in PHP, we will talk about most
Sitemap PHP Tutorial
 | PHP Global Variable | PHP Make Time | PHP MySql Server Version.... | Create a directory in php | Creating a File in the directory. | Create... Questions | Site Map | Business Software Services India PHP Tutorial
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP
php
php   what is php   PHP Tutorials
php
php  im beginner to php. i faced problem with creating form and data...;? //the example of inserting data with variable from HTML form //input.php...')"; //declare in the order variable $result = mysql_query($order); //order
php
php  im beginner to php. i faced problem with creating form and data...;? //the example of inserting data with variable from HTML form //input.php...')"; //declare in the order variable $result = mysql_query($order); //order
php
php  what is php
php
php using javasript  how to set timer in php using javasript
php
php  i want to know about php and php plateform required software to make php program and database that used in php program?   Please visit the following link: PHP database
php
php  i want to know about php and php plateform required software to make php program and database that used in php program?   Please visit the following link: PHP database
php
php  show the constructor overloading in php
PHP
PHP  How to work in drupal with PHP
PHP SQL Timestamp
PHP SQL Timestamp      .... In this example the PHP date() function formats a timestamp to a more readable date.... Source Code of timestamp.php  <?php   error
php
php  what is php   PHP is one of the most used open source server-side scripting language, which runs on almost all the platform. PHP... and Solaris. To know more about PHP, Visit Here
php
php  how to write a program in php to create pdf file
php
php  plz tell me code for PHP SQL Insert,delete,update,view is used to insert the record from HTML page to Mysql database using in single PHP form

Ads