Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Posts
    30

    Unanswered: 500 internal server error help

    error 500 internal server error i have used the same conn code to connect to db and this is ok.Maybe you now another way to show result text in the html page. Help






    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Mostrando los datos</title>
    </head>
    <body>
    
    <?php
    
    $mysql_host="xxxxxxxxxxx";
    $mysql_user="axxxxxs";
    $mysql_password="gxxxxxxs4";
    $mysql_db = "sxxxxia"; 
    $mysql_tables = "jos_call";
    
    $conn= mysql_connect("$mysql_host","$mysql_user","$mysql_password","$mysql_tables")
    or die("Could not connect : " . mysql_error());
    mysql_select_db($mysql_db,$conn)or die("Select database failed"); 
    $sql = mysql_query(”SELECT * FROM jos_call”);
    if (!$sql) {
    echo (”<p> Me temo que te has colado en la query:” . mysql_error() . “</p>”);
    exit();
    }
    // mostramos todos los refranes
    while ($rows = mysql_fetch_array($sql)) {
    echo (”<p><strong>ID: </STRONG>” . $rows['ID'] . “<br />”);
    echo (”<p><strong>paynr: </STRONG>” . $rows['paynr'] . “<br />”);
    echo (”<strong>custnr: </STRONG>” . $rows['custnr'] . “<br />”);
    echo (”<strong>code: </STRONG>” . $rows['code'] . “<br /></p>”);
    }
    mysql_close($conn);
    ?>
    </body>
    <html>

  2. #2
    Join Date
    Mar 2007
    Location
    010101010110100
    Posts
    803
    This should work for you now.

    PHP Code:
    </head>
    <body>

    <?php

    $mysql_host
    ="xxxxxxxxxxx";
    $mysql_user="axxxxxs";
    $mysql_password="gxxxxxxs4";
    $mysql_db "sxxxxia"
    $mysql_tables "jos_call";

    $connmysql_connect("$mysql_host","$mysql_user","$mysql_password","$mysql_tables")
    or die(
    "Could not connect : " mysql_error());
    mysql_select_db($mysql_db,$conn)or die("Select database failed"); 
    $sql mysql_query("SELECT * FROM jos_call");
    if (!
    $sql) {
    echo (
    "<p> Me temo que te has colado en la query:" mysql_error() . "</p>");
    exit();
    }
    // mostramos todos los refranes
    while ($rows mysql_fetch_array($sql)) {
    echo (
    "<p><strong>ID: </STRONG>" $rows['ID'] . "<br />");
    echo (
    "<p><strong>paynr: </STRONG>" $rows['paynr'] . "<br />");
    echo (
    "<strong>custnr: </STRONG>" $rows['custnr'] . "<br />");
    echo (
    "<strong>code: </STRONG>" $rows['code'] . "<br /></p>");
    }
    mysql_close($conn);
    ?>
    </body>
    <html>
    When you write your code, don't run it through microsoft word first, it puts strange characters in your code that cause the parse errors.

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    run with fjm1967's suggestiond for now.....

    just a side comment you need to sharpen up your html
    most tags require an opening and closing
    eg
    Code:
    <h1>A heading of type H1</H1>
    <p>a paragraph of text should be closed by /p tag</p>
    the odd tags are the line break<b>
    which doesn't need an opening & closing tag.. it just is
    some browsers get very sniffy about tags incorrectly used and can cause all manner of problems (especailly table tags).

    another thing is to use whitespace to format your code so its easier to read
    Code:
    if (!$sql) {
    echo ("<p> Me temo que te has colado en la query:" . mysql_error() . "</p>");
    exit();
    }
    // mostramos todos los refranes
    while ($rows = mysql_fetch_array($sql)) {
    echo ("<p><strong>ID: </STRONG>" . $rows['ID'] . "</p>");
    echo ("<p><strong>paynr: </STRONG>" . $rows['paynr'] . "</p>");
    echo ("<strong>custnr: </STRONG>" . $rows['custnr'] . "<br />");
    echo ("<strong>code: </STRONG>" . $rows['code'] . "<br /></p>");
    }
    becomes....
    Code:
    if (!$sql) {
      echo ("<p> Me temo que te has colado en la query:" . mysql_error() . "</p>");
      exit();
    }
    // mostramos todos los refranes
    while ($rows = mysql_fetch_array($sql)) {
      echo ("<p><strong>ID: </STRONG>" . $rows['ID'] . "<br />");
      echo ("<p><strong>paynr: </STRONG>" . $rows['paynr'] . "<br />");
      echo ("<strong>custnr: </STRONG>" . $rows['custnr'] . "<br />");
      echo ("<strong>code: </STRONG>" . $rows['code'] . "<br /></p>");
    }
    personally I tend to go against the commonly seen standard, becuase I find it easier on the eye and groups blocks of code together and use
    Code:
    if (!$sql)
    { echo ("<p> Me temo que te has colado en la query:" . mysql_error() . "</p>");
      exit();
    }
    // mostramos todos los refranes
    while ($rows = mysql_fetch_array($sql)) 
    { echo ("<p><strong>ID: </STRONG>" . $rows['ID'] . "<br />");
      .....
    }
    also consider using CSS to handle you formatting. Its alleged that CSS is best learn't from the beginning as its easier to learn from the start, rahter than unpick your HTML,

    HTH
    Last edited by healdem; 12-29-08 at 03:53.
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    Internal 500 errors are caused by Apache NOT PHP. Check your apache config, and your .htaccess file if you have one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •