6 Replies - 315 Views - Last Post: 24 September 2013 - 06:09 AM

#1 dannybarh  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 19-February 11

Mysqli db connection error

Posted 23 September 2013 - 01:36 AM

Quote

Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2005): Unknown MySQL server host 'http://www.example.com/' (1) in /home/www/fleethabari.com/inc/config.php on line 2
Unable to select database: Unknown MySQL server host 'http://www.example.com/' (1)

Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in /home/www/fleethabari.com/inc/config.php on line 8


$conn=mysqli_connect("http://www.example.com/","xxx","xxx","xxx");
    	// Check connection
    	if (mysqli_connect_errno($conn))
    	  {
    	  echo "Unable to select database: " . mysqli_connect_error();
    	  }
    	mysqli_close($conn);


But my app is written in mysql and not in mysqli, i hope this is not a problem

This post has been edited by Dormilich: 23 September 2013 - 01:38 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Mysqli db connection error

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3390
  • View blog
  • Posts: 9,582
  • Joined: 08-June 10

Re: Mysqli db connection error

Posted 23 September 2013 - 01:46 AM

Quote

But my app is written in mysql and not in mysqli, i hope this is not a problem

the app that uses either mysql or mysqli is written in PHP (both are PHP extensions, not an own language). the MySQL server itself is written in C/C++ and the data stored in MySQL are queried using the SQL language.

back to topic. did you register the host name youíre using? (PHP will do a DNS lookup if you specify something other than localhost). if yes, is there a MySQL server on that host?

EDIT: looks like the latter. try localhost instead (most DB servers do not allow remote connections (= connections via HTTP) anyway)
Was This Post Helpful? 0
  • +
  • -

#3 dannybarh  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 19-February 11

Re: Mysqli db connection error

Posted 23 September 2013 - 01:58 AM

Yes it is a registered host name and i created MySQL server, i used phpmyadmin to create the tables.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3390
  • View blog
  • Posts: 9,582
  • Joined: 08-June 10

Re: Mysqli db connection error

Posted 23 September 2013 - 02:01 AM

then Iíll stick to that

View PostDormilich, on 23 September 2013 - 10:46 AM, said:

try localhost instead (most DB servers do not allow remote connections (= connections via HTTP) anyway)

Was This Post Helpful? 0
  • +
  • -

#5 dannybarh  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 19-February 11

Re: Mysqli db connection error

Posted 23 September 2013 - 02:13 AM

Do i have to use an IP Address ? How do i get it?
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3390
  • View blog
  • Posts: 9,582
  • Joined: 08-June 10

Re: Mysqli db connection error

Posted 23 September 2013 - 03:11 AM

if you donít want to use the name, you can also use localhostís IPs: ::1 and 127.0.0.1.
Was This Post Helpful? 1
  • +
  • -

#7 dannybarh  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 19-February 11

Re: Mysqli db connection error

Posted 24 September 2013 - 06:09 AM

thank for your help its working fine now
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1