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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to a database

Status
Not open for further replies.

MBall2003

Programmer
May 30, 2003
61
0
0
US
I am very new to php and sql, let's say about 2 days of reading the PHP4 Bible. I have previously only worked on MS Access as my only database knowledge. I have a temp database in my companies localhost folder
this is the pathname to where the db is
G:\FoxServ\mysql\data\mball_db

how do i use the function mysql_connect() to connect to the database i know it's a very simple queston but then that means a very simple answer
any help would be greatly appreciated thanks

mball
 
I don't think your question can be answered as asked. You have made a number of incorrect assumptions.

First, a little background. MySQL is a database server (like Microsoft SQL Server), not a database application (like Access or FoxPro). You connect by to a database host by IP address, not to a database file by filesystem name.

Do you have the MySQL database server installed and running?

Want the best answers? Ask the best questions: TANSTAAFL!!
 
You first need to create a MySQL database. The server was installed with Foxserv but you need a database. To establish a database in MySQL, consider installing phpmyadmin on your web server.

For easy administration without the restrictions of HTML layout in phpmyadmin, consider managing your MySQL database with MySQL-Front. This freeware program has been discontinued but can be still found at:

You can begin to worry about connecting to MySQL with PHP after you set up a database.

- - picklefish - -
 
ooops - it looks like you may already have tinkered with phpmyadmin as part of foxserv. Try this...

Code:
<?php

$Host = &quot;localhost&quot;;
$User = &quot;root&quot;;
$Password = &quot;&quot;;
$DBName = &quot;mball_db&quot;;
$Link = mysql_connect ($Host, $User, $Password);

$Query = &quot;SELECT * FROM mball_db&quot;;
$Result = mysql_db_query ($DBName, $Query, $Link);
while ($Row = mysql_fetch_array ($Result)) {
print (&quot;$Row[one_of_your_field_names]<br>\n&quot;);
}

?>

- - picklefish - -
 
try using ADO. u can use the ASP code in PHP!!! (with minor modifications of coures)

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top