3 Replies - 1496 Views - Last Post: 06 October 2017 - 02:58 PM

#1 chronosace11  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-October 17

How to Connect php file into mysql server using xampp?

Posted 04 October 2017 - 07:17 AM

<?php


$host="localhost";
$user="root";
$password="";
$con=mysqli_connect($host,$user,$password);
if(!$con) {
echo '<h1>Connected to MySQL</h1>';
} else {
echo '<h1>MySQL Server is not connected</h1>';
}

?>
Is This A Good Question/Topic? 0
  • +

Replies To: How to Connect php file into mysql server using xampp?

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4138
  • View blog
  • Posts: 13,074
  • Joined: 08-June 10

Re: How to Connect php file into mysql server using xampp?

Posted 04 October 2017 - 07:19 AM

you can add the database name in mysqli_connect() as well.
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13567
  • View blog
  • Posts: 54,133
  • Joined: 12-June 08

Re: How to Connect php file into mysql server using xampp?

Posted 04 October 2017 - 07:19 AM

Care to add more words on what is going on?
Was This Post Helpful? 0
  • +
  • -

#4 benanamen  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 134
  • Joined: 28-March 15

Re: How to Connect php file into mysql server using xampp?

Posted 06 October 2017 - 02:58 PM

Your logic is bass akwards.

This

if(!$con) {

Should be

if($con) {
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1