Problem with mysqli() ....... help required please

reubenn

New Member
Messages
2
Reaction score
0
Points
0
hey ppl, Im a newbie here, as also to web-design.

I have a database named
reuben_headfirst

and a added a user named
reuben_killer

This user has all privileges to the same database

now in my php code,I have the following line

Code:
$dbc = mysqli_connect( 'iammmband.x10.mx', 'reuben_killer', thePassword , 'reuben_headfirst' );
I get the the following warning when I try to access my site.

Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2003): Can't connect to MySQL server on 'iammmband.x10.mx' (111) in /home/reuben/public_html/index.php



What's the problem ? Please help me,I really want to put up this site....
Thanks in advance.

Am I supposed to give my x10-log in username and password ? Or am am I on the right track?

Here's the code in its entirety:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Mismatch - Where opposites attract!</title>
  <link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
  <h3>Mismatch - Where opposites attract!</h3>

<?php
  require_once('appvars.php');
  require_once('connectvars.php');

  // Generate the navigation menu
  echo '❤ <a href="viewprofile.php">View Profile</a><br />';
  echo '❤ <a href="editprofile.php">Edit Profile</a><br />';

  // Connect to the database 
  $dbc = mysqli_connect( 'iammmband.x10.mx', 'reuben_killer', thePassword , 'reuben_headfirst'); 

  // Retrieve the user data from MySQL
  $query = "SELECT user_id, first_name, picture FROM mismatch_user WHERE first_name IS NOT NULL ORDER BY join_date DESC LIMIT 5";
  $data = mysqli_query($dbc, $query);

  // Loop through the array of user data, formatting it as HTML
  echo '<h4>Latest members:</h4>';
  echo '<table>';
  while ($row = mysqli_fetch_array($data)) {
    if (is_file(MM_UPLOADPATH . $row['picture']) && filesize(MM_UPLOADPATH . $row['picture']) > 0) {
      echo '<tr><td><img src="' . MM_UPLOADPATH . $row['picture'] . '" alt="' . $row['first_name'] . '" /></td>';
    }
    else {
      echo '<tr><td><img src="' . MM_UPLOADPATH . 'nopic.jpg' . '" alt="' . $row['first_name'] . '" /></td>';
    }
    echo '<td>' . $row['first_name'] . '</td></tr>';
  }
  echo '</table>';

  mysqli_close($dbc);
?>

</body> 
</html>
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
Hi reubenn,

Replace your Host/Server name to simply 'localhost'

Code:
$dbc = mysqli_connect('[COLOR="red"]localhost[/COLOR]', 'reuben_killer', thePassword , 'reuben_headfirst' );

You can find more information searching the forums and in the x10Hosting Knowledgebase (http://x10hosting.com/kb/questions.php?questionid=15)
 
Top