PDA

View Full Version : fatal error



melvijin
May 11th, 2006, 11:57 AM
right now, im migrating to php5... i opened my script in php 4 and there's a message...


Fatal error: Call to undefined function mysql_connect() in D:\WEBSITES\steco\includes\konek.php on line 7

this is my konek.php



<?php
$dbname="stecodb";
$dbuser="root";
$dbpass="";
$dbhost="localhost";

$db=mysql_connect("$dbhost","$dbuser","$dbpass")
or die("Could not connect");

mysql_select_db("$dbname",$db)
or die ("Could not open db");
?>

can anyone tell me what's wrong with my connection? tnx.. rok on!!!

skOOb
May 11th, 2006, 01:17 PM
looks like your php and mysql arent communicating correctly. it says "Call to undefined function" meaning php doesn't recognize the mysql_connect() function. make sure that the two are configured correctly.

ironikart
May 11th, 2006, 07:55 PM
It means the php version you are using on the server has not been compiled with mysql support (hence no function exists to talk to mysql). If you are able to compile it yourself on the server you need the --with-mysql switch in your ./configure line. Also, the obvious point, make sure you have mysql installed on the server.

CriTiCeRz
May 11th, 2006, 08:38 PM
Well I don't know about PHP5, but I know that you arent supposed to put variables between " ". Try this:



$db=mysql_connect($dbhost,$dbuser,$dbpass)

ironikart
May 12th, 2006, 02:18 AM
The double quote's shouldn't matter, but yeah - it's highly unecessary (must have missed than when I first looked at it)

melvijin
May 12th, 2006, 09:58 AM
thanks for the replies!!! :) i just forgot to paste the libmysql.dll to system32 of the windows....