PHP Script funktioniert überhaupt nicht

  • Hi Leute

    erstmal vorne weg, PHP kann ich überhaupt nicht programmieren. Hab einer eine Page zusammen mit nem Kumpel gebastelt der das kann und es hat auch alles funktioniert.

    Jetzt wollte ich die Page umdesignen mit einem völlig neuem Design (mit Dreamweaver und Templates) nur jetzt öffnet sich dieses PHP Script nicht mehr und er zeigt mir lediglich eine leere Seite an. Hilfe! Warum macht er das? Hier mal das Script:

    <?php
    require_once( "config.php" );
    $link = pg_pconnect( $PG_READ );

    require_once( "include/lib.php" );

    if( isset( $_GET['id'] ) && preg_match( "/^[0-9]+$/", $_GET['id'] ) )
    display_car( "car_new", $_GET['id'] );
    elseif( isset( $_GET['img'] ) )
    lets_die( $_GET['img'] );
    else
    list_cars( "car_new", "Unser Neuwagenangebot" );

    ?>

    und dann am Ende der Seite noch:

    <?php
    //pg_close( $link );
    ?>

    Das Problem ist ich habe einfach die PHP Scripts in meine neue Seite reinkopiert, die Seite läuft aber auf dem gleichem Server und er zeigt mir keine Fehlermeldungen an. Was mach ich falsch? Warum wird das nicht angezeigt? Kann mir jemand helfen? Danke!!!!

  • nein die sind bei mir in nem extra ordner templates. muss ich das template in den ordner kopieren in der auch meine lib ist? aber ich habs auch schon probiert mit "../include/lib.php" klappt aber auch nicht!

  • in meinem hauptverzeichnis sind folgende ordner und dateien:
    admin/.htpasswd, footer.php, header.php, index.php
    admin/include
    admin/include/car_create.php, car_modify.php, image_do_upload.php, image_modify.php, image_upload.php, table.php
    carimg/big
    carimg/small
    carimg/tiny
    content/anfahrt.php, impressum.php, kontakt.php, neuwagen.php, topangebot.php
    images
    include/footer.php, header.php, lib.php
    Templates
    datei - index.php
    datei - config.php

    bringt euch das weiter bei meinem problem?

  • also es geht auch nicht mit deinem code.
    ich weiß nicht was ich falsch mache!

    ich glaube der hat probleme das php script zu öffnen
    denn im browser habe ich nur noch folgenden quelltext:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <title>Unbenanntes Dokument</title>


    <style type="text/css">
    <!--
    .Stil5 {font-size: 10px; color: #666666; }
    .Stil9 {font-size: 12px; font-weight: bold; color: #FFFFFF; }
    body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    }
    -->
    </style>
    </head>

    <body>
    <div align="center">
    <table width="80%" border="0" id="Top">
    <tr>
    <td><div align="center" class="Stil5">Autohaus Weinzierl - Manchinger Stra&szlig;e 134 - 85053 Ingolstadt - 08 41 / 9 68 26 - 0 </div></td>
    </tr>
    </table>

    <table width="85%" border="0" id="navi">
    <tr bgcolor="#000033">
    <td width="17%"><div align="center" class="Stil9" id="Menue">Startseite</div></td>
    <td width="16%"><div align="center" class="Stil9">Topangebot</div></td>
    <td width="17%"><div align="center" class="Stil9">Neuwagen</div></td>
    <td width="17%"><div align="center" class="Stil9">Gebrauchtwagen</div></td>
    <td width="17%"><div align="center" class="Stil9">Anfahrt</div></td>
    <td width="16%"><div align="center" class="Stil9">&Ouml;ffnungszeiten</div></td>
    </tr>
    </table>
    </div>

    <table width="85%" border="2" align="center" bordercolor="#003366" id="hauptframe">
    <tr>
    <td><table width="705" border="0" align="center">
    <tr>
    <td width="185" height="19"></td>
    <td width="383"><div align="center"></div></td>
    <td width="123"></td>
    </tr>
    <tr>
    <td height="19"></td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td height="19"></td>
    <td rowspan="2">

    dann sollte eigentlich der php code anfangen aber den lädt er im browser eben nicht mehr, normalerweiße sollte jetzt

    <?php
    require_once( "../config.php" );
    $link = pg_pconnect( $PG_READ );

    require_once( "../include/lib.php" );

    if( isset( $_GET['id'] ) && preg_match( "/^[0-9]+$/", $_GET['id'] ) )
    display_car( "car_new", $_GET['id'] );
    elseif( isset( $_GET['img'] ) )
    lets_die( $_GET['img'] );
    else
    list_cars( "car_new", "Unser Neuwagenangebot" );
    ?></td>
    <td><div align="center"></div></td>
    </tr>
    <tr>
    <td height="19"></td>
    <td><div align="center"></div></td>
    </tr>
    <tr>
    <td height="19"></td>
    <td></td>
    <td></td>
    </tr>
    </table></td>
    </tr>
    </table>

    <div align="center"></div>
    <p align="center"></p>
    <div align="center">
    <table width="85%" border="0" id="footer">
    <tr>
    <td><div align="center"><span class="Stil5">Impressum | Kontakt </span></div></td>
    </tr>
    </table>
    </div>
    <p align="center"></p>
    <p align="center">
    <?php
    //pg_close( $link );
    ?>
    </p>
    </body>
    </html>

    kommen was es aber nicht tut! was mache ich falsch

  • haue mal ganz am anfang der index datei ein <?PHP error_reporting(E_ALL); ?>

    Ich vermtue mal, das du in der zu includenden Datei einen Fehler hast, weshalb diese nich geprast werden kann.

  • ich schreib dir mal den code von der lib.php:
    <?php
    function list_cars( $table, $caption )
    {
    global $_SERVER;
    global $_GET;

    ?><style type="text/css">
    <!--
    body,td,th {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #000000;
    font-size: 14px;
    }
    .StilNEU {
    font-size: 18px;
    font-weight: bold;
    }
    .Stil5 {font-size: 10px; color: #666666; }
    a:visited {
    color: #0033FF;
    text-decoration: none;
    }
    a:hover {
    color: #000099;
    text-decoration: none;
    }
    a:active {
    color: #0000CC;
    text-decoration: none;
    }
    a:link {
    color: #003399;
    text-decoration: none;
    }
    -->
    </style>
    <div align="center"></div>
    <table width="400" border="1" align="center" id="mainframe">
    <caption><?php echo enhance( $caption ); ?></caption><?php

    $result_brand = pg_query( "SELECT DISTINCT(\"brand\") FROM \"".$table."\" WHERE \"active\" = 'true' ORDER BY \"brand\"" );

    while( $row_brand = pg_fetch_row( $result_brand ) )
    {
    ?><tr><th><?php echo $row_brand[0]; ?></th></tr><?php

    $result_model = pg_query( "SELECT \"id\",\"model\" FROM \"".$table."\" WHERE \"brand\" = '".$row_brand[0]."' ORDER BY \"model\"" );

    while( $row_model = pg_fetch_row( $result_model ) )
    {
    ?><tr><td>; ?>?file=<?php echo $_GET["]&amp;id=<?php echo $row_model[0]; ?>"><?php echo $row_model[1]; ?></td></tr><?php
    }
    }
    ?></table><?php
    }

    function display_car( $table, $id = FALSE )
    {
    global $_SERVER;
    global $_GET;

    pg_query( "SET lc_monetary TO 'de_DE'" );

    $sql = "SELECT \"image\",\"brand\",\"model\",\"description\",\"color\",\"performance\",".( $table != "car_new" ? "\"regdate_from\",\"km_from\"," : "" )."\"fuel\",\"doors\",\"features\",\"price\" FROM \"".$table."\"";
    $sql .= " WHERE \"active\" = 'true'";
    if( $id != FALSE ) $sql .= " AND \"id\" = '".$id."'";

    $result = pg_query( $sql );

    if( !( $row = pg_fetch_row( $result ) ) ) return;

    # get ready to display image
    $images = explode( '.', $row[0] );

    if( isset( $_GET['img'] ) )
    {
    if( !preg_match( "/^[0-9]+$/", $_GET['img'] ) )
    {
    lets_die( $_GET['img'] );
    return;
    }

    if( empty( $images[ ( $next_img = $_GET['img'] + 1 ) ] ) )
    $next_img = 0;

    if( empty( $images[ ( $prev_img = $_GET['img'] - 1 ) ] ) )
    $prev_img = count( $images ) - 1;

    if( empty( $images[ $_GET['img'] ] ) )
    {
    $curr_img = 0;
    }
    elseif( $_GET['d'] == "x" )
    {
    /* display image full size */
    ?>
    <div align="center"></div>
    <div align="center"></div>
    <div align="center"></div>
    <div align="center"></div>
    <div align="center"></div>
    <div align="center"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?file=<?php
    echo $_GET['file']; ?>&amp;<?php echo ( $id == FALSE ? "" : "id=".$id."&amp;" ); ?>img=<?php
    echo $_GET['img']; ?>">

    <img src="../carimg/big/<?php
    echo $images[ $_GET['img'] ]; ?>.jpg" alt="full" width="830" height="630" border="0" /> </p>


    <?php
    return;
    }
    /* no longer needed **
    elseif( $_GET['d'] == "y" )
    {
    header( "Content-type: image/jpg" );
    $img_res = pg_query( "SELECT \"small\" FROM \"images\" WHERE \"id\" = '".$images[ $_GET['img'] ]."'" );
    $img_data = pg_fetch_row( $img_res );

    echo pg_unescape_bytea( $img_data[0] );
    exit;
    }
    elseif( $_GET['d'] == "z" )
    {
    header( "Content-type: image/jpg" );
    $img_res = pg_query( "SELECT \"big\" FROM \"images\" WHERE \"id\" = '".$images[ $_GET['img'] ]."'" );
    $img_data = pg_fetch_row( $img_res );

    echo pg_unescape_bytea( $img_data[0] );
    exit;
    }
    ** */
    else $curr_img = $_GET['img'];
    }
    else
    {
    # default values
    $prev_img = count( $images ) - 1;
    $next_img = 1;
    }

    if( !isset( $curr_img ) ) $curr_img = 0;

    # row counter
    $num = 0;
    ?>
    </p>
    </div>
    <table width="662" align="center">
    <tr>
    <td height="221" colspan="2" valign="top">
    <h2 class="subheader"><?php echo $row[++$num]." ".$row[++$num]; ?></h2>
    <div class="description">
    <?php echo $row[++$num]; ?>


    <?php
    if( !empty( $row[($num+1)] ) )
    {
    ?>

    Bei uns k&ouml;nnen Sie jedes Fahrzeug zu ihren Wunschkonditionen finanzieren!

    &Uuml;ber ein pers&ouml;nliches Beratungsgespr&auml;ch in unserem Haus w&uuml;rden wir uns sehr freuen.</p>
    </div>

    F&uuml;r eine Probefahrt bitten wir sie kurzfristig einen Termin mit unserer Verkaufsabteilung zu vereinbaren.</p>
    </td>
    </tr>
    <tr>
    <td width="252" valign="top">

    </p>

    <span class="StilNEU">Farbe:</span>

    <?php echo $row[++$num]; ?></p>

    <span class="StilNEU">Leistung:</span>

    <?php echo $row[++$num]; ?>

    <?php
    if( $table != "car_new" )
    {
    if( !empty( $row[(++$num)] ) )
    {
    ?>


    <span class="StilNEU">Erstzulassung:</span>

    <span class="registered"><?php echo $row[$num]; ?>

    </span><?php
    }
    if( !empty( $row[(++$num)] ) )
    {
    ?>
    </p>

    <span class="StilNEU">Kilometer:</span>

    <?php echo $row[$num]; ?>
    <?php
    }
    }
    ?>


    <span class="StilNEU">Kraftstoffart:</span><br class="StilNEU">
    <?php echo $row[++$num]; ?></p>

    <span class="StilNEU">Anzahl der T&uuml;ren:</span>

    <?php echo $row[++$num]; ?>

    <?php
    }
    else
    {
    if( $table != "car_new" )
    $num+=6;
    else
    $num+=4;
    }
    ?>
    </p>

    <span class="StilNEU">Ausstattung:</span>

    <?php echo $row[++$num]; ?></p>

    Irrtum und Zwischenverkauf vorbehalten! </p></td>
    <td width="520" height="9" align="center" valign="top">

    </p>
    <table align="center">
    <tr>
    <td colspan="2"><a href="<?php echo $_SERVER['PHP_SELF'];
    ?>?file=<?php echo $_GET['file']; ?>&amp;id=<?php echo $id; ?>&amp;img=<?php
    echo $curr_img; ?>&amp;d=x"><img src="../carimg/small/<?php
    echo $images[ $curr_img ]; ?>.jpg" alt="preview" width="330" height="250" border="0" /></a></td>
    </tr>
    <tr>
    <?php
    if( isset( $images ) && count( $images ) > 1 )
    {
    ?>
    <td align="left"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?file=<?php
    echo $_GET['file']; ?>&amp;<?php echo ( $id == FALSE ? "" : "id=".$id."&amp;" ); ?>img=<?php
    echo $prev_img; ?>">&lt;&lt;</a></td>
    <td align="right"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?file=<?php
    echo $_GET['file']; ?>&amp;<?php echo ( $id == FALSE ? "" : "id=".$id."&amp;" ); ?>img=<?php
    echo $next_img; ?>">&gt;&gt;</a></td>
    </tr>
    <?php
    }
    else
    {
    ?>
    <td align="left">&lt;&lt;</td>
    <?php
    ?>
    <td align="right">&gt;&gt;</td>
    <?php
    }
    ?>
    <tr>
    <td colspan="2" align="left"><div align="center"><b id="price"><?php echo enhance( preg_replace( "/^[^0-9]+/", "", $row[++$num] ) ); ?> &euro;[/b]</div></td>
    </table></td>
    </tr>
    </table>

    <table width="80%" border="0" align="center">
    <tr>
    <td><div align="center"><span class="Stil5">Impressum | Kontakt </span></div></td>
    </tr>
    </table>

    </p>
    <div align="center"></div>
    <?php
    }

    siehst du da irgendeinen fehler?

  • lol das hab ich ja gemacht aber trotzdem funktioniert es nicht.... es ist komisch. eine andere seite lädt er von dieser lib datei nur diese tabelle nicht..