Re: PHP, MYSQL and Apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Keith,

Browse to your phpinfo(); page, and search it for mysql.  Is it listed?  If not, the mysql module isn't enabled, and you shouldn't expect a mysql_connect command to work.  You may need to edit your php.ini and enable the php_mysql.dll module.  

Refer to the results of phpinfo(); for the path to the active php.ini file, since sometimes this can be an unexpected location on Windows machines, at least in my experience.

Regards,
Carlton Whitehead

----- Original Message -----
From: "KM" <thalor@xxxxxxxxxxx>
To: php-windows@xxxxxxxxxxxxx
Sent: Monday, August 6, 2007 4:58:36 PM (GMT-0500) America/New_York
Subject:  PHP, MYSQL and Apache

I am attempting to use the following together….

 

MYSQL 5.0

Apache 2.2.4

PHP 5.2.3

 

PHP info I can get.  I get the following statement whenever trying to get to
mysql

 

 

Here is the PHP code for what I’m trying to do…

 

<?php

 // Connect to the database

 $dbhost = 'localhost';

 $dbusername = 'root';

 $dbpasswd = 'joker';

 $database_name = 'simple';

 $connection = mysql_connect("$dbhost","$dbusername","$dbpasswd")

  or die ('Couldn\'t connect to server.');

 $db = mysql_select_db("$database_name", $connection)

  or die('Couldn\'t select database.');

 

 // Generate SQL code to store data on database.

 $insert_sql = 'INSERT INTO simple_table (text) VALUES (\'test text,
1,2,3\')';

 

 // Execute SQL code.

 mysql_query( $insert_sql )

  or die ( 'It Didn\’t Work: ' . mysql_error() );

 

 // Tell User we are done.

 echo 'Code Inserted';

?>

 

 

Fatal error: Call to undefined function mysql_connect() in C:\Program
Files\Apache Software Foundation\Apache2.2\htdocs\test_insert_mysql.php on
line 7

 

Anyone had this before and have a solution, it would be appreciated.

 

Keith


No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.6/938 - Release Date: 8/5/2007
4:16 PM
 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux