mysqli query generates 500 internal server error
$mysql_connection = new mysqli(blah blah blah..
$query = "SELECT * FROM posts ORDER BY id DESC";
$result = $mysql_connection->query($query);
That little last instruction here generates a 500 Internal Server Error in my site, I didn't posted the whole code because I didn't want to make you stay hours to read it. I tested it by printing something after every instruction that may have caused the error, and when it reaches the query part, id stops.
开发者_高级运维I'm a very beginner in PHP, so sorry if it's a dumb question.
So, any little hint will be very appreciated.
it looks like the connection is not going through for some reason can you add this to your code and post the output
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
look at the error log. there should be some more info as to why it's failing. if still unable to fix problem, post the error log entry here so we can help you
精彩评论