On Jan 21, 2008, at 4:14 PM, Dave Goodchild wrote:

Don't be scared of functions, no magic or mystery there, all you are doing
is putting your code in a function like so:

function add($a, $b) {
return $a + $b;
}

..for example and calling it like so:

$a = 12;
$b = 100;
$sum = add(12, 13);

...etc etc, not too much more to learn than that and now I can call add() in
many places...


So all I have to do (At least to really simplify what I'm sure they can do) is put the code I want to execute into the function and then just list the variables as arguments? Such as:

function dbconnect ($host, $user, $pass, $database) {
mysqli_connect($host, $user, $pass, $database);
etc. etc.

}

Or something like that?

And then I can simply call my dbconnect() anywhere I might need to connect to a database? Or a different database?


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to