Preserved Topic: variable scope (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: |
posted 02-03-2002 06:11
1) Is there a way I can define $db so I can use it in any of my functions? Otherwise I have to write same line in both functions. code: $db = mysql_connect("localhost", "root");
|
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 02-03-2002 06:56
Basically |
Nervous Wreck (II) Inmate From: |
posted 02-03-2002 07:05
quote:
|
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 02-03-2002 08:22
You shouldn't use "root" user to connect to MySQL database. You should also define a password for that user, since you're connect to your database as root user (which has admin privileges) and you don't have a password defined. You should define password for root, and also other user account which can only access database that you're using... |
Nervous Wreck (II) Inmate From: |
posted 02-03-2002 18:37
How do I define a password for root? (this is on windows) |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 02-03-2002 23:58
I suggest that you take a look at MySQL documentation where you'll find answers to all your question that you may have about MySQL: http://www.mysql.com/documentation/index.html |
Paranoid (IV) Inmate From: Lebanon |
posted 02-04-2002 15:01
quote:
|
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 02-04-2002 19:55
There shouldn't be an issue with global vars They are only related to scope |
Paranoid (IV) Inmate From: Minneapolis, MN, USA |
posted 02-05-2002 01:25
By the way, you only need that $db variable if you are maintaining connections to multiple databases. mysql_query uses the default connection if only one connection is open. |