logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 08-15-2008, 05:20 PM   #1
rattlsnak
 
Join Date: Aug 2008
Posts: 175
Default database question.. MySQL/PHP

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!
rattlsnak is offline   Reply With Quote
Old 08-16-2008, 07:45 AM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

Quote:
Originally Posted by rattlsnak View Post
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.

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

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?
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 08-16-2008, 04:13 PM   #3
rattlsnak
 
Join Date: Aug 2008
Posts: 175
Default

Quote:
Originally Posted by rattlsnak
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!
rattlsnak is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:51 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com