global variables and MySQL

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   global variables and MySQL
wolf
CZ Active Member
usa.gif indiana.gif
Occupation: Student; Flash, HTML, PHP developer
Age: 34
Gender: Male
Status: Offline
Joined: Jul 25, 2003
0.02 posts per day
Posts: 168
Points: 10,417
AIM Address Yahoo Messenger MSN Messenger 
How do i assign a variable global?? Case in point, im trying to connect to the database, but im tired of typing it in on all the pages that query it. So, I'm trying to assign $dbconnect the connection of the database, then the query will be whatever the user is doing.

Also, and srry, im wanting to put something into the database, can someone explain to me what exactly tables and feilds are, and just how to put something in them from the web? Thanks, Wolf.




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#2   re: global variables and MySQL
wolf
CZ Active Member
usa.gif indiana.gif
Occupation: Student; Flash, HTML, PHP developer
Age: 34
Gender: Male
Status: Offline
Joined: Jul 25, 2003
0.02 posts per day
Posts: 168
Points: 10,417
AIM Address Yahoo Messenger MSN Messenger 
any help here would be greatly appreciated...




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#3   re: global variables and MySQL
SpLiNteR
CZ Addict
SpLiNteR has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student
Age: 34
Gender: Male
Fav. Sports Team: Leeds United
Website:
Status: Offline
Joined: Feb 08, 2004
0.05 posts per day
Posts: 397
Points: 206,328
AIM Address Yahoo Messenger MSN Messenger ICQ Number
Make a file with the db connection stuff then simply use an include on ever file that needs connecting to the database.

The database is the large thing which is then divided into tables. Each tables has "headings" for example userID, userName, userPassword. Then the "headings" would be set into the table and you could add records under the "headings"




_________________
Back to top Reply with quote
#4   re: global variables and MySQL
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
I just use the way nuke does if i'm making a php mysql site, include it in the header, then you can just use mysql( whatever ) or i duno i forget how ya do that lol icon_razz.gif instead of putting include whenever ya wana use it




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#5   re: global variables and MySQL
wolf
CZ Active Member
usa.gif indiana.gif
Occupation: Student; Flash, HTML, PHP developer
Age: 34
Gender: Male
Status: Offline
Joined: Jul 25, 2003
0.02 posts per day
Posts: 168
Points: 10,417
AIM Address Yahoo Messenger MSN Messenger 
ok, so i would make an external file with the "connection", not the queries or inserts?

and im trying to figure out what exactly to put my information into...this is how i see it

you have the database that stores everything, then you have tables inside of the db...then fields inside the tables.

if my users type in their email...where do i store that information in the database? in the field? or is there something else?

Thanks, Wolf




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#6   re: global variables and MySQL
SpLiNteR
CZ Addict
SpLiNteR has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student
Age: 34
Gender: Male
Fav. Sports Team: Leeds United
Website:
Status: Offline
Joined: Feb 08, 2004
0.05 posts per day
Posts: 397
Points: 206,328
AIM Address Yahoo Messenger MSN Messenger ICQ Number
Yeah, so you have a connection.php file, this contains how the file is connected to the database, so you can simply use an include everytime everytime you want to connect to the db rather than writing it out. Also, protect the file from access, i don't think it's possible to read PHP code from a webserver, but if they can they've got your database username and password so you're a bit pruned.




_________________
Back to top Reply with quote
#7   re: global variables and MySQL
Kelly_Hero
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
usa.gif southcarolina.gif
Occupation: Web Developer
Age: 59
Gender: Female
Website:
Status: Offline
Joined: Aug 20, 2003
0.48 posts per day
Posts: 3765
Points: 351,412
   
icon_rolleyes.gif I'm glad I'm not the one trying to make sense of all that! icon_razz.gif

Here are some tutorials that might help:
[ Register or login to view links on this board. ] [ Register or login to view links on this board. ]



Back to top Reply with quote
#8   re: global variables and MySQL
wolf
CZ Active Member
usa.gif indiana.gif
Occupation: Student; Flash, HTML, PHP developer
Age: 34
Gender: Male
Status: Offline
Joined: Jul 25, 2003
0.02 posts per day
Posts: 168
Points: 10,417
AIM Address Yahoo Messenger MSN Messenger 
Thanks Kelly, it helped a bit. And thanks splinter, i got the include() going, and the code looks so much cleaner.




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum