faqts : Computers : Programming : Languages : PHP : Database Backed Sites

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 16 people (38%) answered Yes
Recently 3 of 10 people (30%) answered Yes


How can i insert into a MySQL DB table through multiple .php file? is there a connection id?

Mar 10th, 2006 08:18
Praveen Kumar Kukkapalli, Dawit Abraham, Cinley Rodick, David Greenberg, Mohamed Farouk, http://www.generalforums.com , http://www.generalforums.com/yellow/

Yes, you can use the connection_id.
$conn_id = mysql_connect("HOST", "USER", PASS);
then while executing query 
$result = mysql_query("SQL QUERY", $conn_id);
Then you can work with multiple databases in the same script. You just
need to establish different onnections and use that connectionID for
executing the queries on tables in different databases.
Yes, the mysql_connect() function returns a "resource," which acts as 
handle to the current connection.  Like other variables, this can be 
passed to another page using POST or GET variables.
You may want to use the mysql_pconnect() function for a persistent 
connection. Refer http://www.php.net/mysql_pconnect for more