Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 14th, 2005, 12:20 PM
Authorized User
Join Date: Mar 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to arimakidd
Default Undefined Function Error

I am building this script step by step and the first step is not working. Simply to connect to mysql, here's the code:
$connect = mysql_connect("localhost","root","newman$") or
die ("Hey loser, check your server connection.");
echo "if you gotten this far it means things worked out";
Instead I get the following error:

Fatal error: Call to undefined function mysql_connect() in C:\apache\Apache2\development\mysql_up.php on line 11
Line 11 is as follows:
$connect = mysql_connect("localhost", "root", "newman$")
My OS is xp pro and I have successfully installed apache and php5. Mysql works fine at the command prompt. The script I am writting is in php and the entire thing is simple and short:
$host = "localhost";
$user = "root@localhost";
$pass = "newman$";
//connect to MySQL; note we've used our own parameters - you should use 
//you own for hostname, user, and password
$connect = mysql_connect("localhost", "root", "newman$") or
die ("Hey loser, check your server connection.");
Need Help

Old October 19th, 2005, 01:48 PM
Friend of Wrox
Join Date: Mar 2004
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul

See o/p of phpinfo(). PHP5 has no automatic working module of MySQL, you need enable it.

Support Indian students' finances http://scholarship.mediasworks.com/
Old November 10th, 2005, 02:54 AM
Registered User
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

do the following
1)include your php path (e.g c:\php)in the enviroment variables.
my computer-->Properties-->Advanced-->Enviroment Variables-->Select "PATH" from the list and press Edit.go to the end of line and
enter your php path for example c:\php

2)Copy php_mysql.dll to c:\php (or to your php path). if it is already there then ok.
   (you can find it in the ext folder of your php folder)
3)copy libmysql.dll to c:\php (or to your php path). if it is already there then ok.

4)Open php.ini file and add the following line in the extension list
  Save and close file.

5)restart your system.

6)Your above code is right now run it again.
          thanks (imran ali)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fatal error: Call to undefined function mysql_pcon surendran Beginning PHP 2 May 23rd, 2006 10:41 PM
undefined function vurtman ASP.NET 1.0 and 1.1 Basics 8 October 4th, 2004 01:32 PM
Undefined function dhborchardt Classic ASP Databases 0 June 7th, 2004 03:31 PM
error Call to undefined function: query() gmanon Wrox Book Feedback 1 November 20th, 2003 06:34 PM
undefined function: mysql_connect() shabboleth Beginning PHP 2 September 18th, 2003 05:09 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.