[UPHPU] Calling MySQL Functions within a class or function

John lists at strictlyrockymountain.com
Sun May 7 00:51:57 MDT 2006


For myself, I always include 1 file at the top of every PHP file.  I know
others do it as well, and we use it to setup site variables, and start
sessions, etc.  In mine I also include my db.php which initiates a mysql
connect call and sets up the database link.  I call it $dblink.

So when I call a mysql query inside of a function, I have to include the
$dblink with global because it's not availabe inside of a function.  This
then brings the connection into the fuction and I can call mysql queries
at any time in the function.  Classes may be different, I don't use them.

function myfunct()
    {
    global $dblink;
    blah
    }

Thanks
John





More information about the UPHPU mailing list