homepage Welcome to WebmasterWorld Guest from 54.196.196.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
HTTP 500 Internal Service Error
UniverseBoard




msg:3932925
 6:58 am on Jun 14, 2009 (gmt 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--;
}

?>

 

Habtom




msg:3932941
 8:20 am on Jun 14, 2009 (gmt 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
  • g1smd




    msg:3932956
     9:38 am on Jun 14, 2009 (gmt 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.

    nick279




    msg:3933150
     7:25 pm on Jun 14, 2009 (gmt 0)

    Put this at the top of your code also

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

    jdMorgan




    msg:3933164
     7:53 pm on Jun 14, 2009 (gmt 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

    UniverseBoard




    msg:3933313
     4:32 am on Jun 15, 2009 (gmt 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.

    Global Options:
     top home search open messages active posts  
     

    Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
    rss feed

    All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
    Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
    WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
    © Webmaster World 1996-2014 all rights reserved