Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to connect to db in IIS environment

Status
Not open for further replies.

knuckle05

Programmer
Dec 17, 2001
247
CA
HI All,

I've created my first MySQL db. It's currently located in the C:\MySQL\Data directory. BTW, I'm using Win 2000 Pro

Normally in the past, using ASP, I've been able to put my Access database directly amongst my ASP files and call it from my ASP script.

How do I set this up in PHP? Do I have to leave my database at the C:\MySQL\Data directory, or can I move it to my folder?

Also, when moving this from my local test workstation to my web host, how do I move my whole database over?

Any tips would be greatly appreciated.

Thx!
 
You have asked a very large question
it would take days to explain how to do a hole setup
you are way behind

I am willing to help, but one step at a time and you will learn along the way

if this is ok ? let me know and I will help you

since I just learned all that, it's fresh in my mind

:)

--------------------------------------
"Hacker by Heart"
saenzcorp@hotpop.com
 
First, there is the conceptual change you must make.

Access is a database engine. Basically, it doesn't matter where the file is, the preinstalled Microsoft Jet database engine fires up and handles your manipulation of the file.

MySQL is a database server. At no point will your code ever manipulate, touch, or even reference the actual files where your data is stored. Your code will contact the MySQL server and hand it commands. MySQL will then enact those commands and return errors or data where necessary. In this regard, MySQL is in the same class of object as Microsoft SQL Server, not Microsoft Access.

The operations that you use to interact with MySQL (or pretty much any database server PHP supports) fall into the same order:[ol][li]Connect to MySQL (see mysql_connect())[/li][li]Select the database in which you will be manipulating data (see mysql_select_db())[/li][li]Send MySQL a Structured Query Language (SQL) query that fetches or changes data in that database (see mysql_query())[/li][li]If you're fetching data, loop through the data return, outputting and further manipulating data where necessary. (see mysql_fetch_array(), mysql_fetch_assoc(), mysql_fetch_object or mysql_fetch_row())[/li][li]close your connection to MySQL (see mysql_close())[/li][/ol]

Example code for these operations can be found on the PHP online manual page for mysql_fetch_assoc()[link] and other places.

Want the best answers? [url=http://www.catb.org/~esr/faqs/smart-questions.html]Ask the best questions!


TANSTAAFL!!
 
Thx for your responses.

Maverick, if you are willing to give me some step by step instruction, I'm more than willing to listen.

Thx dude.
 
One easy may to manage the connection is to dl and install myODBC which is the odbc driver engine for the mysql db. When installed yo ucan then create a dsn for the DB then its standard asp to connect.
 
bastienk:
Why are we talking about myODBC and ASP in the PHP forum, particularly when PHP on Win32 has MySQL connectivity built into it?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
whoops...too many forums...lost what little I had of my mind...

i have signed up for remedial reading classes

:)
 
With all due respect to our Tip-Master(sleipnir214) because he has helped me quit a bit in the more advanced stuff! please listen to what he has to say ! with that said...

sometimes a step by step approach is needed!

OK, here we go from the beginning: general
first make sure MySQL is installed properly
MySQL comes with a small programm(winMySQLadmin)
that has a Start Check Tab that tells you if all is well

always install MySQL on win2ksrv first,
if at all possible, uninstall things like MS Exchange, IIS, and any other programs that may conflict! this is a big issue on win2ks, use Apache web services and php4+,
these are designed to run with MySQL
I installed them like this, MySQL > Apache > Php4

this insures that apache can see mysql and php can see apache and mysql

once you have confirmed mysql is working you should have a Street Light with a Green by the clock on your desktop!

check your Apache config files to confirm they are setup like you want them "httpd.conf"

check your php.ini files to make sure that is right also
remember to shutdown web services to make changes on php.ini or httpd.conf file...

some programs you will need:
phpMyAdmin-2.5.6 - to control mysql

to check php run: in a web page
<?php
phpinfo();
?>
this confirms php is running

then run this to check mysql connection:
$db_conn = mysql_connect("localhost", "userid", "password");
if(!$db_conn)
{
echo 'Cannot connect to database.';
exit;
}

~ To Be Continued ~ :p

--------------------------------------
"Hacker by Heart"
saenzcorp@hotpop.com
 
Hey Maverick,

Good stuff, I've now installed PHP and mySQL and have everything running and have created my database with the MySQL Control Center.

I'm running in an IIS environment but everything seems to be working correctly.

So thanks for your help thus far...its been much appreciated.

I have one other issue that I've been wondering about, I think I'll open another thread,...

thx!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top