Page 1 of 1

Selecting Data - connecting to db

Posted: Mon Aug 19, 2002 10:04 pm
by ccouture
New to MySQL & PHP, thankfully not so new to databases. Need to get my brain wrapped around a concept and have a kick in the right direction. I have a database up, wish to allow members of my org to select from the database to see a list of names, etc. Scripts will be in a password protected directory on hosted web site. Problem is this: how do I allow connection to database? I can't obviously include my username/pwd in the scripts. I cannot create a generic account as per my host's own rules, or I'd create one with limited permissions, etc. and put that info in the script. So, how can I allow access to the database without a username/pwd? I've worked on huge applications like PeopleSoft running on SQL Server, DB2, etc, and I've always had to perform some login ritual before I could do anything.

I've not written any PHP code yet, just thumbed through some, but this concept has me befuddled. Help?

Posted: Mon Aug 19, 2002 10:14 pm
by volka
you have to provide a valid username/password to mysql_connect (unless the default values described in the manual do fit) and they have to be in plain text in the script.

As long as the php-parser is on, no one will see the script source.
mysql stores it's own user table so there's no need the user exists as system user.

Posted: Mon Aug 19, 2002 10:20 pm
by ccouture
PHP Parser?

Posted: Mon Aug 19, 2002 10:25 pm
by volka
sorry.
As long as your script is parsed by the webserver or the commandline version of php.

The difference between <?php phpinfo(); ?> results in the php configuration/credits page or an empty page (containing the plain text in "source view") in a webbrowser. Nevermind, as long as your server is configured properly no one shall see the plain script data

Posted: Mon Aug 19, 2002 10:33 pm
by llimllib
more of your 'not a teacher day', eh volka? lol.

Posted: Mon Aug 19, 2002 11:27 pm
by volka
the day ended 6 and half an hour ago (at least here in good ol' germany).
Seems to be "I'm not a teacher"-week.
take a look at php - Letter
OMG, I should stop before someone gets hurt.

My next and only goal is to prevent it from becoming "can't express anything"-month ;)

edit & btw: Ultimate: besides squash the best sport in this century (most likely ;) )

Posted: Tue Aug 20, 2002 6:27 am
by llimllib
If I'm not goofing off on the forum, I'm playing ultimate, so I tend to agree with you. they play much in germany?