PDA

View Full Version : database question.. MySQL/PHP


rattlsnak
08-15-2008, 04:20 PM
Hey guys,
I've built a website that has a members only section and within that section, I want to add a page that a member can submit info to be added to the database that can be searched later by any member.

Few Questions,..
1. On the overall member pages, does the mysql_connect script used to connect to the database for the user auth. have to be on every page within the member pages? or only on the check login page that starts the Session ID?

2.Does php or mysql allow connectivity to two different databases on the same page? (see question #3)

3. I have built two databases with appropriate tables, one to hold the user auth data, the other to hold the data to be submited from the user. The two are not related, so it is OK to do it that way, or should I put the user submit data into a table under the same database?

4.On the user submit pages, should I use a msql_connect script to connect to the databse/table where i want the info to go at the top of the page, or does that need to be done from the INSERT scripts from the form?


I have already built all the form pages and error pages, etc for the user to submit the info, but I havent added the script yet, as I need to know the above answers first.
Thanks!

davidj
08-16-2008, 06:45 AM
1. On the overall member pages, does the mysql_connect script used to connect to the database for the user auth. have to be on every page within the member pages? or only on the check login page that starts the Session ID?

your connection script needs to be on every page that requires a connection to a db before you perform your query.

2.Does php or mysql allow connectivity to two different databases on the same page? (see question #3)
yes

3. I have built two databases with appropriate tables, one to hold the user auth data, the other to hold the data to be submited from the user. The two are not related, so it is OK to do it that way, or should I put the user submit data into a table under the same database?

you should only use 1 db and have seperate tables

4.On the user submit pages, should I use a msql_connect script to connect to the databse/table where i want the info to go at the top of the page, or does that need to be done from the INSERT scripts from the form?
not sure what you mean by this?

rattlsnak
08-16-2008, 03:13 PM
Quote:
Originally Posted by rattlsnak http://www.dreamweaverclub.com/forum/images/buttons/viewpost.gif (http://www.dreamweaverclub.com/forum/showthread.php?p=142885#post142885)
1. On the overall member pages, does the mysql_connect script used to connect to the database for the user auth. have to be on every page within the member pages? or only on the check login page that starts the Session ID?

your connection script needs to be on every page that requires a connection to a db before you perform your query.

>OK, just to confirm, I use the connect script to check the login for the users on the member login page, and once the session id is started unless i want to run another query on the other member pages I do not have to run the connect script on those pages.

Quote:
2.Does php or mysql allow connectivity to two different databases on the same page? (see question #3)
yes


Quote:
3. I have built two databases with appropriate tables, one to hold the user auth data, the other to hold the data to be submited from the user. The two are not related, so it is OK to do it that way, or should I put the user submit data into a table under the same database?
you should only use 1 db and have seperate tables


>>I thought about that, but does it really matter if the two tables are completely unrelated? Long story, but I built the second database on another PC when I didnt have access to my host server. I guess I could just import the table over, but I brought the whole database over instead.

Quote:
4.On the user submit pages, should I use a msql_connect script to connect to the databse/table where i want the info to go at the top of the page, or does that need to be done from the INSERT scripts from the form?
not sure what you mean by this?

>> You answered this question above. I was wondering if I had to connect to the database first before using an INSERT statement or was it part of the INSERT statement script. I understand now that either way, I have to connect first.



THANKS! as always!

This is fun stuff!