Forum Moderators: coopster
I have a PHP script that starts with an include:
<?php
include ("/home/initializedatabase.php");## Process some database stuff here
$resultID = mysql_query("Select * from table1, etc",$linkID);
## Call a function
more_db_stuff(item$);
function more_db_stuff($item) {
$resultID2 = mysql_query("Select * from table2, etc",$linkID);
print "stuff";
}
?>
What is the best way to include the SAME database parameters inside AND outside of the function? I should also mention that the function will be inside a loop, so I don't think I want to continually initialize the DB on every iteration.
Thanks for the help, and sorry if I'm not making perfect sense.
I am not 100% sure what you mean, do you mean the $linkID? So just have your connection available everywhere in your script?
you don't actually need to specify the connection you want to use unless there is more than one, it uses the last opened connection by default.