You are here: Re: Connect to MySQL Database using PHP « PHP Programming Language « IT news, forums, messages
Re: Connect to MySQL Database using PHP

Posted by christopher_board on 05/07/07 22:23

On 7 May, 23:14, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> christopher_bo...@yahoo.co.uk wrote:
> > On 7 May, 21:11, ZeldorBlat <zeldorb...@gmail.com> wrote:
> >> On May 7, 3:59 pm, christopher_bo...@yahoo.co.uk wrote:
>
> >>> Hi all. I am trying to connect to a MySQL Database using PHP on a
> >>> local machine using locahost. I am using the following code
> >>> <?php
> >>> $dbhost = 'localhost';
> >>> $dbuser = 'root';
> >>> $dbpass = 'password';
> >>> $conn = mysql_connect($dbhost, $dbuser, $dbpass) or
> >>> die ('Error connecting to mysql');
> >>> $dbname = 'pmoneytest';
> >>> mysql_select_db($dbname);
> >>> ?>
> >>> When I view the page it then comes up with an error that says
> >>> PHP Fatal error: Call to undefined function mysql_connect() in C:
> >>> \Inetpub\wwwroot\PHPTest\connection.php on line 6. I can't see what
> >>> the problem is as I got the code from the Internet and it seems to be
> >>> the same on all the different website that I look at.
> >>> Thanks very much for your help and I look forward to hearing from you
> >>> in the near future.
> >> Make sure that you've enabled the MySQL extension in php.ini. You can
> >> check this by running the following script and examining the output:
>
> >> <?php
> >> phpinfo();
> >> ?>- Hide quoted text -
>
> >> - Show quoted text -
>
> > Hi. I have checked the phpinfo(); and MySQL seems to be ok as it is
> > pointing to where the server is installed. But the internet page still
> > doesn't work. Is there anything else that I can try.
>
> Christopher,
>
> Does phpinfo() have a mysql section? It will have items like:
>
> Active Persistent Links 0
> Active Links 0
> Client API version 5.0.32
> MYSQL_MODULE_TYPE external
>
> and so on.
>
> Your symptom is indicates that the mysql extension is not loaded in php.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================- Hide quoted text -
>
> - Show quoted text -

Hi. There isn't actually heading called MySQL but it does have Active
Persistent Links 0. The things that you mentioned are not
shown in phpinfo();.

Thanks very much for your help in this matter

 

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

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