Jump to content

Internal Server Error


sKunKbad

Recommended Posts

I'm working on creating a sidebar that has all of the links to content that appears on the page, and when clicking the links they sometimes work fine and other times I get this server error:

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, support@supportwebsite.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.

Apache/1.3.33 Server at www.mysite.com Port 80

 

Ive never seen anything like this, and my code seems to be simple, so I don't know what is going on. It all started when I worked on this code tonight:

 

<?php
if (!isset($_GET['tip'])){
$tipPage = 'current';
$thisTip = mysql_query("SELECT * FROM tipsntricks WHERE tipType = '$tipPage'");
}else{
$tipPage = $_GET['tip'];
$thisTip = mysql_query("SELECT * FROM tipsntricks WHERE tipNum = '$tipPage'");
}
$row = mysql_fetch_array($thisTip);
extract($row);
echo "$tipTitle\n";
echo "$tipCodeTop\n";
echo "$tipPicMid\n";
echo "$tipCodeMid\n";
echo "$tipPicBottom\n";
echo "$tipCodeBottom";
?>

 

It seems pretty straight forward to me. This is on godaddy servers. Its really weird that when I get the error, if I refresh the page it usually shows the appropriate page with content. Here is the complete code minus the database connection:

 

<?php
echo "<h2 style='margin-bottom:-17px;'>Past Tips & Tricks</h2><ul>";
$tipTypes = array(exhaust,suspension,engine);
foreach ($tipTypes as $tipCat){
$query = "SELECT * FROM tipsntricks WHERE tipType = '$tipCat'";
$result = mysql_query($query);
$num_rows = mysql_num_rows ($result);
	if ($num_rows != 0){
		echo "<li class='prodcat'><h3>" . ucfirst($tipCat) . "</h3><ul>";
		while($row = mysql_fetch_array($result)){
			extract($row);
			echo "<li><a href='" . $_SERVER['SELF'] . "?tip=" . $tipNum . "'>" . $tipTitle . " </a></li>";
		}
		echo "</ul></li>";
	}
}
echo "</ul>";
?>

<?php
if (!isset($_GET['tip'])){
$tipPage = 'current';
$thisTip = mysql_query("SELECT * FROM tipsntricks WHERE tipType = '$tipPage'");
}else{
$tipPage = $_GET['tip'];
$thisTip = mysql_query("SELECT * FROM tipsntricks WHERE tipNum = '$tipPage'");
}
$row = mysql_fetch_array($thisTip);
extract($row);
echo "$tipTitle\n";
echo "$tipCodeTop\n";
echo "$tipPicMid\n";
echo "$tipCodeMid\n";
echo "$tipPicBottom\n";
echo "$tipCodeBottom";
?>

 

Anyone know what's going on with this?

Link to comment
Share on other sites

You're best of reading your sites error log. godaddy should have a section set up for you to view your sites access/error logs. Internal Server Error 500 error messages writes the true error to the servers error log.

 

Without knowing why you are getting the error I cant really help. However normally Internal Server Error 500 error messages  are caused by server configuration issues.

 

EDIT: Just noticed this line:

$tipTypes = array(exhaust, suspension, engine);

 

You should wrap strings within quotes, unless exhaust, suspension,  and engine are constants:

$tipTypes = array('exhaust', 'suspension', 'engine');

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.