I try to echo my database (hosted on ipage.com) using php and I get this error : Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
What is wrong? $mysqli = new mysqli("site.ipagemysql.com", "user", "pass", "database");
alone, works, so it is not a error in the connection right? or I have to contact the host?
My code
<?php
$mysqli = new mysqli("site.ipagemysql.com", "user", "pass", "database");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", $mysqli->host_info);
$result = mysqli_query($link, "SELECT DATABASE()"))
$row = mysqli_fetch_row($result);
printf("Default database is %s.\n", $row[0]);
mysqli_free_result($result);
?>
You have one ) too many on line 12, it’s missing a semicolon and you haven’t changed the
$linkvariable to correspond with the$mysqlivariable on line 3.Also, you’re mixing object oriented style with procedural style. I’d recommend you to use OO style only. So the code would be: