You are here: How to use MySQL from PHP ? « PHP Programming Language « IT news, forums, messages
How to use MySQL from PHP ?

Posted by YoLed on 01/03/08 18:03

I have to work with PHP and MySQL but I'm new with this environnement.
So, I've started installing a plateform of mine. So under Windows,
Apache, PHP5 and MySQL.

All sounds right when I write a simple .php page and when I manipulate
a mysql database(s) at command line.

But, when time commes to write something simple using PHP and MySQL, I
get an error : PHP odoesn't seems to recognise a simple instruction like
mysql_connect.

Here is my code :

a db_config.php file containing :
<?php
$db_host = "localhost";
$db_user = "php";
$db_password = "f00";
$db_name = "buzzDB";
?>

a temp_con.php file containing :
<?php
require($_SERVER["DOCUMENT_ROOT"]."/mysql_test/db_config.php");
$connection = mysql_connect($db_host, $db_user, $db_password) or die
("error connecting");
echo "connection made";
?>

And when I launch temp_con.php in the framework of the local webserver
(say http://dev-server/mysql_test/temp_con.php), I got this error
message in the web browser :

"Fatal error: Call to undefined function mysql_connect() in Y:\4Apache
\vhosts\dev\htdocs\mysql_test\temp_con.php on line 3"

What's happens ? What should I do ? Is there something missing in the
PHP config to be able to use MySQL commands ?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация