Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases 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 September 25th, 2007, 03:12 PM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default connect to mysql db from php 5

Hi Guys, PHP-newbie!

Trying to connect to my MySQL DB with the following code:

Code:

<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'mypassword';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'crmpicco_mini';
mysql_select_db($dbname);
?>

My apache error log shows:
[Tue Sep 25 21:04:45 2007] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function mysql_connect() in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\index.php on line 6

Which is the mysql_connect line. Commented in both dll lines from php.ini. Can anyone spot the problem here? Just trying to get setup with PHP on my local machine for the first time?

Picco

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old September 26th, 2007, 05:14 PM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

got to the bottom of it, when i installed PHP with the .msi installer I didn't select any extensions. So i just went into Add/Remove programs, selected PHP, clicked 'Change'. Selected the Extensions MySQL and MySQLi and the coded worked fine after an Apache restart!

:-)

Picco

www.crmpicco.co.uk
www.ie7.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
php connect to mySql parrot face PHP Databases 3 March 20th, 2007 03:42 AM
Connect php to mysql Nicholsen MySQL 1 December 3rd, 2006 02:34 AM
connect to MySQL DB from Perl crmpicco Perl 2 October 5th, 2006 11:23 AM
connect to MySQL DB -(0x80004005) crmpicco Classic ASP Databases 0 May 18th, 2006 12:31 PM
php connect to mysql p2ptolu Beginning PHP 2 February 24th, 2005 10:43 AM





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