473,383 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

mysql_connect() fails - PHP, Apache, MySQL on WinXP

I have Apache 2 parsing and serving PHP files just fine on my winXP
box, however, when I try to add some mysql database functionality I
get a warning that looks like this:

Fatal error: Call to undefined function mysql_connect() in
D:\SITES\mysql.php on line 3

I am able to connect to mysql via the terminal just fine. Due to the
error "undefined function" I wonder if I set PHP up wrong or
something. Any ideas?

Here is the code:

<?php
// basic install of MySQL 4.0.20a-nt
$mysql = mysql_connect("localhost","root","mysql");

$query = "select id, site from crypt";

$result = mysql_db_query("test", $query);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>mysql page</title>
</head>
<body>
<table>
<tr>
<th>Id</th>
<th>Site</th>
</tr>
<?php while ($array = mysql_fetch_row($result)) : ?>
<tr>
<td><?php echo $array[0] ?></td>
<td><?php echo $array[1] ?></td>
</tr>
<?php endwhile; ?>
</table>
</body>
</html>

--------------------------

And here is some other info that might be useful to you:

Z:\>c:\php\php -v
PHP 5.0.0 (cli) (built: Jul 13 2004 21:39:58)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.0, Copyright (c) 1998-2004 Zend Technologies

Z:\>mysql -V
mysql Ver 12.22 Distrib 4.0.20a, for Win95/Win98 (i32)

--snip--
MySQL is not the problem:
--snip--
Z:\>mysql -uroot -pmysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9 to server version: 4.0.20a-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test;
Database changed
mysql> select id, site from crypt;
+----+---------+
| id | site |
+----+---------+
| 1 | foo |
| 2 | hotmail |
| 3 | hotmail |
| 4 | hotmail |
+----+---------+
4 rows in set (0.00 sec)

mysql>

-----------------------------------

TIA!
Jul 17 '05 #1
0 2046

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BT | last post by:
Hi .. a newbie question. I get the following error: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/index.php on line 3. I have the following RPMS installed on RH7.2...
1
by: Justin | last post by:
Hi, I am continualy receiving the following type of error in my browser from programs using php/mysql Warning: mysql_connect(): Can't create a new thread (errno 11). If you are not out of...
6
by: Allen Guan | last post by:
Hello all, I am running MYSQL 4.1.17, PHP 4.3.9 under apache 2.0.52 on solaris. PHP seems to work fine, except that it can't connect to mysql database. I got this error: Warning:...
0
by: Justin | last post by:
Hi, I am continualy receiving the following type of error in my browser from programs using php/mysql Warning: mysql_connect(): Can't create a new thread (errno 11). If you are not out of...
19
by: Michael | last post by:
Hi, I'm trying to do something which should be very simple - connect to the MySQL database. Here is the call, followed by the error msg. $conn = mysql_connect("localhost", "root", ""); ...
6
by: GD | last post by:
Hi All, I've got MySQL 5.0.21 running on Windows Server 2003, and php running on Apache on a Linux box (Fedora Core 4). Previously when the pages were running on an IIS server the connection...
14
by: brett | last post by:
I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php file with <? $dbc = mysql_connect (); ?> When I run the file, I get this error: Fatal error: Call to undefined...
0
by: java | last post by:
Hi there! After I overcame some short_open_tag (thanks, Rik!) I encounter another strange php-behaviour. The script I just got to work on the windows-commandline obviously does as php.ini tells...
14
by: farhan | last post by:
Hi, Please divert me if this is not the right group to be posting this question. I am a Linux client trying to connect to a mysql windows server via php, upon hitting the mysql_connect line...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.