Welcome to WebmasterWorld Guest from 54.160.221.82

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

HTTP 500 Internal Service Error

     
6:58 am on Jun 14, 2009 (gmt 0)

New User

5+ Year Member

joined:June 9, 2009
posts:2
votes: 0


Here is the whole copy of my coding, and when I upload and try to open the page, I met the Http 500 error.
Please help me check the code, I don't see any problem myself after so many times of modification and failure...
Thanx


<?php $BoxID=1; //the starting box ID value

//connect to MySQL database
mysql_connect('localhost','****username***','****pw***') or die('cannot connect the database');
mysql_select_db('****dbname****');

//start building the table content
define($table_row,10);//10 rows
define($table_c,5);//and 5 coloums, forms 50 boxes

while ($table_row>0)
{
echo ('<tr>');
while ($table_c>0)
{
//query from the Database for each box.
$query=mysql_query("SELECT * FROM ***tablename*** WHERE ID='$BoxID'");

if($query)//determine if the box contain any content
{
$result=mysql_fetch_array($query);
define($url,$result[7])
define($title,$result[1])
define($text,$result[6])
define($img_url,$result[2])
define($imgh,$result[3])
define($imgw,$result[4])
define($expire,$result[8])

echo ('<td width="160" height="150" valign="top"><p align="center" class="emptybox">UniverseBoard Box #$BoxID<br> <a onClick="href=\'$url\'" style="cursor:hand" title="$text" class="BoxTitle">$title<br>
<img src="$img_url" width="$imgw" height="$imgh"><br>
</a><span class="Expire">Expire: $expire</span></td>')
}//for if function

else //the box contains nothing in database
{
echo('<td width="160" height="150" valign="top"><p align="center" class="emptybox">UniverseBoard Box #$BoxID<br><br><br><p align="center" class="emptybox">This box is AVAILABLE<br /><a href="advertise.php" class="emptybox">Order here</a></td>');
}//else

$BoxID++;
$table_c--;
}//for this row of table
echo ('</tr>');
$table_row--;
}

?>

8:20 am on June 14, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 15, 2004
posts:1867
votes: 0


Two errors I noticed are:

  • ";" missing in many of your lines.
  • I normally use define for constants and var for variables to declare them
  • 9:38 am on June 14, 2009 (gmt 0)

    Senior Member

    WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

    joined:July 3, 2002
    posts:18903
    votes: 0


    Start by uploading a file like:

    <html><body>Can you see these words?</body></html>

    and see if you get the same error message.

    The problem might not be your script at all.

    7:25 pm on June 14, 2009 (gmt 0)

    Junior Member

    5+ Year Member

    joined:July 21, 2008
    posts:103
    votes: 0


    Put this at the top of your code also

    error_reporting(E_ALL);
    ini_set("display_errors", 1);

    7:53 pm on June 14, 2009 (gmt 0)

    Senior Member

    WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

    joined:Mar 31, 2002
    posts:25430
    votes: 0


    ... And when you get a 500-Server error, go straight to the server error log and read it -- It often contains very useful information about errors.

    Jim

    4:32 am on June 15, 2009 (gmt 0)

    New User

    5+ Year Member

    joined:June 9, 2009
    posts:2
    votes: 0


    Thank you guys. The problem solved.
    I need to apologize, the cause of the problem is that I DID miss many ";" behind those define statements.
    Then I used direct assignments instead of "define"s, the page displays well by now.
     

    Join The Conversation

    Moderators and Top Contributors

    Hot Threads This Week

    Featured Threads

    Free SEO Tools

    Hire Expert Members