All,
Which way below is the better method ? Basically A.PHP calls a function from
B.PHP that contains a mess of db variables (i.e. fields, table names, etc.).
The variables that are returned are used throughout the rest of the A.PHP
script.
I have left out the contents of $a,$b and $c and changed the function names
and variable names for a more simple posting.
a.php
-----
db_function(); //from b.php
b.php
------
function db_function ()
{
global $a, $b, $c;
$a = ""; //fields
$b = ""; //table
$c = ""; //id
}
or this way...
a.php
-----
list ($a, $b, $c) = db_function();
b.php
------
function db_function ()
{
$a = ""; //fields
$b = ""; //table
$c = ""; //id
return array ($a, $b, $c);
}
Many thanks.
Which way below is the better method ? Basically A.PHP calls a function from
B.PHP that contains a mess of db variables (i.e. fields, table names, etc.).
The variables that are returned are used throughout the rest of the A.PHP
script.
I have left out the contents of $a,$b and $c and changed the function names
and variable names for a more simple posting.
a.php
-----
db_function(); //from b.php
b.php
------
function db_function ()
{
global $a, $b, $c;
$a = ""; //fields
$b = ""; //table
$c = ""; //id
}
or this way...
a.php
-----
list ($a, $b, $c) = db_function();
b.php
------
function db_function ()
{
$a = ""; //fields
$b = ""; //table
$c = ""; //id
return array ($a, $b, $c);
}
Many thanks.
Comment