Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql_connect() Undefined function??

Status
Not open for further replies.

G60corrado

Technical User
Jul 17, 2002
10
CA
Hey Guys/Girls
I'm just getting started with Mysql and PHP. I've used the add packages function through Red Hat 8.0 to get it set up.

My question is I get this when I try to connect to the database

Fatal error: Call to undefined function: mysql_connect() in /var/ on line 13

Do I need to edit something in php.ini?? Any help would be awsome. Thanks

My code is

<?

$dbuser = 'root';

$dbhost = 'localhost';

$dbpass = 'password';

$dbname = 'test2';

$dbtble = 'books';

$mysql_link = mysql_connect($dbhost,$dbuser,$dbpass);

$column = mysql_list_fields($dbname,$dbtble,$mysql_link);

for($i=0; $i< mysql_num_fields($column); $i++ )
{
print mysql_field_name($column,$i ).&quot;<br>&quot;;
}

?>
 
Did you install the php-mysql RPM? It contains the functions that you need to use the MySQL support of PHP. //Daniel
 
I assume you installed PHP from rpm.

What PHP rpms did you install? Specifically, did you install php-mysql? ______________________________________________________________________
TANSTAAFL!
 
I installed everything under packages that related to php or mysql but when I do a display of rpms that one is not listed. I'll go on a hunt and see if I can find it. Thanks for the help. Oh ya do I have to do anything special to get it to work since php and mysql are allready installed?
 
Restart Apache, maybe? ______________________________________________________________________
TANSTAAFL!
 
O.K. I got it working. I had to install php-mysql.rpm. It didn't come with RH 8.0 but was on RPM find. Thanks for the help.
 
danielhozac,

Didn't we both tell him to install the php-mysql rpm? ______________________________________________________________________
TANSTAAFL!
 
Contrary to G60Corrado's comment, the package does ship with RH8.0.

Each of your install CD's has a /RedHat/RPMS directory on it. Find a file, the name of which is php-mysql<something> in that directory on one of your install CD's.

Issue: rpm -Uvh <name of file>

on it. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top