justin1003356 asked:
Ok, so i have a lot of different php scripts like user management, shopping cart, forums. I don’t want my customers to have to sign-up multiple times for my website. I need to know how to do this.
Ok, so i have a lot of different php scripts like user management, shopping cart, forums. I don’t want my customers to have to sign-up multiple times for my website. I need to know how to do this.
Thanks A lot


2 Comments to 'How do you use 1 database for multiple php scripts?'
August 14, 2010
You only need the one database, you can connect to it from as many scripts as you want.
Each script will have something like ( for MySQL )
$conn = mysql_connect($dbhost, $dbuser, $dbpass)
or die (’Error connecting to mysql’);
Have a look at for more examples.
August 16, 2010
Everytime the user restarts the browser/tab, it is sure that he/she must login again (just informing).
For your problem, you must use the global variable $_COOKIE (good tutorial link:). This way the server will remember the user. $_SESSION may also be a great help. And you must ensure that each sript will have access to a script responsible for staying the database connection alive (a simple way to do it). It will be very long if I’ll tell you everything but I guess you will get some ideas with this answer…..just look for cookies and sessions.