Jump to content

how to try a remote connection host gator and if fails connect by localhost


nadav_rock

Recommended Posts

 

i test codes using remote connection ot host gator. but have to each time uncomment to swtich it back to connection that would work live on server. is there a solution such as try remote connection catch regular connection?


  $conn = mysqli_connect("50.87.155.149", "nadavrock", "xxx", "nadavroc_personal_website");
// $conn = mysqli_connect("localhost", "nadavrock", "xxx", "nadavroc_personal_website");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

Link to comment
Share on other sites

2 hours ago, nadav_rock said:

i am new to php. can you give me the code for the simple if else statment?

Since you are new, you may not know the authors of Php have offered a free manual. You will need to refer to this manual all throughout your programming journey so best to bookmark it. Php Manual.

Here is the specific manual page that will teach you about if/elsif/else.
https://www.php.net/manual/en/control-structures.elseif.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.