Sa177ir Posted November 10, 2006 Share Posted November 10, 2006 For a group project, we have to create a web-app in PHP. We are using MySQL as our DBMS.The first page of our webapp requires a user to enter in information to connect to a certain database through the MySQL server. This page is the only time the user enters in this information.The problem is that we have several php scripts that need this user-inputted database in order to open a connection to do some queries. I would open a persistent mysql connection, but it cannot be closed?I guess I could pass the db information from php script to php script, but that seems inefficient. There has to be a better way.Any suggestions...? Link to comment https://forums.phpfreaks.com/topic/26798-mysql-connections-through-php/ Share on other sites More sharing options...
Jfisher446 Posted November 10, 2006 Share Posted November 10, 2006 You could have a php file for the db connection and just include it on every page that needs the connection.[code]<?phpinclude "dbConnect.php";do whatever?>[/code] Link to comment https://forums.phpfreaks.com/topic/26798-mysql-connections-through-php/#findComment-122555 Share on other sites More sharing options...
exoskeleton Posted November 10, 2006 Share Posted November 10, 2006 i think Jfisher446 was trying to imply the code like this:[code]<?phpinclude("dbConnect.php");do whatever?>[/code]he just miss the open and close parenthesis..Hope it will help...Good Luck..More power... Link to comment https://forums.phpfreaks.com/topic/26798-mysql-connections-through-php/#findComment-122568 Share on other sites More sharing options...
Sa177ir Posted November 11, 2006 Author Share Posted November 11, 2006 So...if dbConnect.php does a "post" to grab the user input, will every page that includes it have access to the user input? Link to comment https://forums.phpfreaks.com/topic/26798-mysql-connections-through-php/#findComment-123231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.