sKunKbad Posted July 8, 2007 Share Posted July 8, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/58901-internal-server-error/ Share on other sites More sharing options...
wildteen88 Posted July 8, 2007 Share Posted July 8, 2007 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'); Quote Link to comment https://forums.phpfreaks.com/topic/58901-internal-server-error/#findComment-292405 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.