[PHP] PHP zeigt immer eine 0 am Anfang an

Dieses Thema im Forum "Webentwicklung" wurde erstellt von Fr3DdY123, 27. April 2009 .

Schlagworte:
Status des Themas:
Es sind keine weiteren Antworten möglich.
  1. 27. April 2009
    PHP zeigt immer eine 0 am Anfang an

    Hallo,
    habe folgendes Problem:
    Ich habe eine PHP-basierte Homepage, die in einem Frame weitere PHP-Dokumente included. Die Inhalte der eingebundenen PHPs sind fehlerfrei, aber beim Betrachten in einem Webbrowser wird vor dem Inhalt immer eine 0 angezeigt. Hab ich mir also gedacht -> Klar, Fehler in der base.php.
    Die hab ich jetzt aber schon 2 Stunden vergeblich nach irgendwelchen überflüssigen Nullern durchsucht und absolut keine gefunden...

    =>Ich stehe vor einem Rätsel!

    Kann mir vllt irgendwer weiterhelfen? Bin über jede Hilfe dankbar!
     
  2. 27. April 2009
    AW: PHP zeigt immer eine 0 am Anfang an

    glaskugel anmach: ne ich seh nix sorry

    soll heißen: poste den quelltext
     
  3. 27. April 2009
    AW: PHP zeigt immer eine 0 am Anfang an

    oh, sry, vergessen

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>-</title>
    <link rel="stylesheet" type="text/css" href="css.css">
    <script type="text/JavaScript">
    <!--
    function MM_swapImgRestore() { //v3.0
     var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    
    function MM_preloadImages() { //v3.0
     var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    function MM_findObj(n, d) { //v4.01
     var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
     if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
     for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
     if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_swapImage() { //v3.0
     var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
     if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->
    
    </script>
    
    <style type="text/css">
    <!--
    #apDiv1 {
     position:relative;
     width:0px;
     height:0px;
     z-index:1;
     left: 60px;
     top: -120px;
    }
    #apDiv2 {
     position:relative;
     width:0px;
     height:0px;
     z-index:2;
     left: 800px;
     top: -130px;
    }
    #apDiv3 {
     position:relative;
     width:0px;
     height:0px;
     z-index:3;
     left: 680px;
     bottom: 215px;
    }
    #apDiv4 {
     position:relative;
     width:0px;
     height:0px;
     z-index:4;
     top: -80px;
     left: 260px;
    }
    #apDiv5 {
     position:relative;
     width:0px;
     height:0px;
     z-index:5;
     left: 190px;
     top: -275px;
    }
    #apDiv6 {
     position:relative;
     width:0px;
     height:0px;
     z-index:6;
     left: 450px;
     top: -225px;
    }
    -->
    </style>
    
    </head >
    
    <body bgcolor="#eeeeee" onLoad="MM_preloadImages('grafik/themenbuttons/hausaufgaben_h.gif','grafik/themenbuttons/schuelerbistro_h.gif','grafik/themenbuttons/eltern_kind_h.gif','grafik/themenbuttons/jugendliche_h.gif','grafik/themenbuttons/teenies_h.gif','grafik/themenbuttons/kids_h.gif')">
    
     <font face="Arial">
    
    
    <br />
    
     
    <table width="994" border="0" cellspacing="0" cellpadding="0" align="center">
    
     <tr>
     <td><a href="?go=home" border="0"><img src="grafik/topbuttons/01_Home.gif" width="142" height="50" border="0" /></a></td>
     <td><a href="?go=aktionen" border="0"><img src="grafik/topbuttons/02_Aktionen.gif" width="142" height="50" border="0" /></a></td>
     <td><a href="?go=programm" border="0"><img src="grafik/topbuttons/03_Programm.gif" width="142" height="50" border="0" /></a></td> 
     <td><a href="?go=oeffnungszeiten" border="0"><img src="grafik/topbuttons/04_Oeffnungszeiten.gif" width="142" height="50" border="0" /></a></td>
     <td><a href="?go=fotogalerie" border="0"><img src="grafik/topbuttons/05_Fotogalerie.gif" width="142" height="50" border="0" /></a></td>
     <td><a href="?go=ansprechpartner" border="0"><img src="grafik/topbuttons/06_Ansprechpartner.gif" width="142" height="50" border="0" /></a></td>
     <td><a href="?go=kontakt" border="0"><img src="grafik/topbuttons/07_Kontakt.gif" width="142" height="50" border="0" /></a></td>
     </tr>
     
     <tr>
     <td height="249" colspan="7"> <img src="grafik/haus/haus.jpg" width="994" height="249" /> </td>
     </tr>
    </table>
    
    <table width="994" border="0" cellspacing="0" cellpadding="10" align="center">
     <tr bgcolor="#cbcbcb">
     <td colspan="7" height="100%" align="justify">
     
     <div id="apDiv6" border="0"><a href="?go=hausaufgaben" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('hausaufgaben','','grafik/themenbuttons/hausaufgaben_h.gif',1)"><img src="grafik/themenbuttons/hausaufgaben.gif" name="hausaufgaben" width="100" height="75" border="0"/></a></div>
     <div id="apDiv5" border="0"><a href="?go=schuelerbistro" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('schuelerbistro','','grafik/themenbuttons/schuelerbistro_h.gif',1)"><img src="grafik/themenbuttons/schuelerbistro.gif" name="schuelerbistro" width="81" height="81" border="0"/></a></div>
     <div id="apDiv4" border="0"><a href="?go=eltern_kind" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('eltern_kind','','grafik/themenbuttons/eltern_kind_h.gif',1)"><img src="grafik/themenbuttons/eltern_kind.gif" name="eltern_kind" width="87" height="64" border="0"/></a></div>
     <div id="apDiv3" border="0"><a href="?go=jugendliche" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('jugendliche','','grafik/themenbuttons/jugendliche_h.gif',1)"><img src="grafik/themenbuttons/jugendliche.gif" name="jugendliche" width="99" height="138" border="0"/></a></div>
     <div id="apDiv2" border="0"><a href="?go=teenies" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('teenies','','grafik/themenbuttons/teenies_h.gif',1)"><img src="grafik/themenbuttons/teenies.gif" name="teenies" width="105" height="139" border="0"/></a></div> 
     <div id="apDiv1" border="0"><a href="?go=kids" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('kids','','grafik/themenbuttons/kids_h.gif',1)"><img src="grafik/themenbuttons/kids.gif" name="kids" width="75" height="97" border="0"/></a></div>
     
     
    
     <?php 
    
    $main = $_GET["go"];
    echo $main+"test";
    switch ($main) {
    
     case "";
     include("home.php");
     break;
     
     case "home";
     include("home.php");
     break;
    
     case "aktionen";
     include("aktionen.php");
     break;
    
     case "programm";
     include("programm.php");
     break;
     
     case "oeffnungszeiten";
     include("oeffnungszeiten.php");
     break;
     
     case "fotogalerie";
     include("fotogalerie.php");
     break;
     
     case "ansprechpartner";
     include("ansprechpartner.php");
     break;
     
     case "kontakt";
     include("kontakt.php");
     break;
     
     case "kids";
     include("kids.php");
     break;
     
     case "teenies";
     include("teenies.php");
     break;
     
     case "jugendliche";
     include("jugendliche.php");
     break;
     
     case "eltern_kind";
     include("eltern_kind.php");
     break;
     
     case "schuelerbistro";
     include("schuelerbistro.php");
     break;
     
     case "hausaufgaben";
     include("hausaufgaben.php");
     break;
     
     case "impressum";
     include("impressum.php");
     break;
     
    
    }
    
    ?> 
    </table>
    
    
    <table width="994" border="0" cellspacing="0" cellpadding="0" align="center">
     
     </td>
     </tr>
     
     <tr>
     <td colspan="7" background="grafik/bottomleiste/bottomleiste.gif" height="50" align="center" ><a href="?go=impressum">Impressum</a></td>
     
     </tr>
     
    </table>
    </font>
    </body>
    </html>
     
  4. 27. April 2009
    AW: PHP zeigt immer eine 0 am Anfang an

    kannst du vielleicht n screen oder den HTML output posten?
    Ich kann mir schlecht vorstellen an welcher Stelle genau die "0" da ist.
    Fernerhin , hast du die ganzen sub-PHP Files durchsucht?

    Ist es bei allen $_GET['go'] Sections?
     
  5. 27. April 2009
    AW: PHP zeigt immer eine 0 am Anfang an

    Ja genau mach mal das was Smokers sagte.
    Durchsuch alle Include-Files ob da irgendwas steht.

    Sonst könnte ich mir nurnoch das echo in den Sinn kommen.
    Das hier meine ich:
    PHP:
    echo  $main + "test" ;
     
  6. 27. April 2009
    AW: PHP zeigt immer eine 0 am Anfang an

    + => zahlen addieren
    . => strings kombinieren

    string + string = 0

    wird intern als intval(string) + intval(string) behandelt (bzw: floatval)

    mfg
     
  7. 27. April 2009
    AW: PHP zeigt immer eine 0 am Anfang an

    Ty Murdoc dachte ich doch das richtige

    Also Fr3DdY123 einfach
    PHP:
    echo  $main + "test" ;  
    löschen und weg sollte die 0 sein.

    Kannst es aber auch in
    PHP:
    echo  $main  "test" ;  
    ändern und dann zeigst es den Inhalt der Variable $main an und test
     
  8. 27. April 2009
    AW: PHP zeigt immer eine 0 am Anfang an

    wunderbar, danke, dummes echo...


    danke an alle


    closed
     
  9. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.