?
Solved

Question on MySQL and PHP

Posted on 2000-01-10
4
Medium Priority
?
396 Views
Last Modified: 2010-04-22
Hi,

I am trying to write a page in PHP3 running on my Redhat 6.1. I have Apache 1.3.9, MySQL 3.22.27 and PHP 3.0.12 running ok. However, when I want to the following code running my Linux:


=======================================
<?php

$db = mysql_connect('localhost', 'root','');

mysql_select_db("mydb",$db);

$result = mysql_query("SELECT * FROM employees",$db);

printf("First Name: %s<br>\n", mysql_result($result,0,"first"));

printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));

printf("Address: %s<br>\n", mysql_result($result,0,"address"));

printf("Position: %s<br>\n", mysql_result($result,0,"position"));

?>
=======================================

I have the following error:

=======================================
Fatal error: Call to unsupported or undefined function mysql_connect() in /home/httpd/html/php/showdb.php3 on line 11
=======================================

It seems that I need to do connections for the PHP an MySQL.  However, most of the document I found on the web just teaching me install and recompile the php3 and mysql from scratch. Do I really need to do it? Can I just change some config file and restart the services? If yes, which file I should change.

I would be appreciated if there is a step by step instruction for!

Thanks

Joe


0
Comment
Question by:fokchi
  • 2
  • 2
4 Comments
 

Author Comment

by:fokchi
ID: 2341840
Adjusted points to 150
0
 
LVL 4

Accepted Solution

by:
feenix earned 300 total points
ID: 2343394
Have you installed the PHP-mysql module and configured it in the php3.ini? PHP might not use the MySQL module by default, and if that is the case, it would give the error you described.
0
 

Author Comment

by:fokchi
ID: 2344088
hi feenix,

Can you tell me how to install the MySQL module? Where I can I find it and how to install it?

Thanks,
0
 
LVL 4

Expert Comment

by:feenix
ID: 2344585
Seems like there is no MySQL module for PHP in the RedHat 6.1 CD, strange. But I did find the module from a few places, one is ftp://ftp.muni.cz/pub/linux/local/redhat-cz/6.1/local/RPMS/php-mysql-3.0.12-8cs.i386.rpm

Just install it (rpm -i package), and then open your /etc/httpd/conf/php3.ini. There should be a section names Dynamic Extensions. There should read:
extension=mysql.so

Then your MySQL module should work okay.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question