Jump to content


Photo

Call To Undefinded Function mysql_connect


  • This topic is locked This topic is locked
43 replies to this topic

#41 aung

aung
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 07 March 2008 - 04:19 AM

Thanks.

It returns the error due to login name and password I used. I used "root" and its password. But, somehow it did not work.

I created the new user and then tried again.

It worked on this time.

Thanks again.

Tin Aung Soe

#42 db530

db530
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 27 May 2008 - 08:58 PM

I'm having an error connecting to the database for the admin section of my website and I think it relates to this topic. It's weird because I'm able to connect to the database for every other section of the site. Here is the error when I try to log in to the admin section:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /data/16/1/57/83/1546246/user/1664829/htdocs/admin/functions.php on line 6
Database connectivity Error

The function in question (line 6 is the if statement):

function dbcon(){
global $host, $user, $pass, $db,$link;
if(!($link=mysql_connect($host,$user,$pass) && mysql_select_db($db)))
{
sprintf("Internal error %d %s",mysql_errno(),mysql_error());
return 0;
}
else
{
return 1;
}
}


Everything works fine in PHP4, its when I switched to PHP5 that I started getting errors. Any idea whats wrong?

#43 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 28 May 2008 - 05:45 AM

Has nothing to do with the mysql extension not being bundled.

If you manage your own server, ensure that the server is running (probably it is) on the local machine, and make sure right socket file is used. This should help with that:

http://www.tech-reci...ql_tips762.html

If not, contact your host.

#44 padduweb

padduweb
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 July 2008 - 09:58 AM

check this site PHP Answers
For more info.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users