Hi
How can I use a MySQL database with PHP?
How the MySQL works on the server?
Where I must put my files?
Can someone please send me an example source code to access a MySQL database?
I'm new to PHP...
thanks
Rolf
PHP files usually has the extension .php or .php3 depending on your server config. You can put PHP files inside your website's document root directory. If you need examples, you can check out this site:
I'll also add that the book "Professional PHP Programming" was a big help getting me started with PHP and MySQL. Chapter 2 is titled "Installing and Configuring PHP", and has sections for the web server, PHP, and MySQL. It's not an all-encompassing reference book, but it is a good book - I use it all the time, along with the main php web site
<?php<br>
$host="localhost"; <br>
$user="your user name";<br>
$password="your password"; <br>
mysql_connect($host,$user,$password) or die("Failed"<br>
$result=mysql_db_query("database name","...operation you want...." <br>
-> get result to generate your html code <br>
....<br>
....<br>
mysql_close( );<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.