Beiträge von feinshdens

    hallo und einen guten morgen,


    ich arbeite gerade das buch, PHP 5.3 & Mysql 5.5 vom verlag galileo computing, durch.
    in kapitel 14.1 auf seite 587 stoße ich auf folgende aussage:


    Zitat

    ...Zunächst wird durch den Befehl [code] str_replace("\\", "/", __DIR__) aus dem Projektpfad ein Pfad mit korrekten Slashes erstellt. So wird aus D:/XAMPP/htdocs/Galielo ein D:\XAMPP\htdocs\Galileo....


    das machte mich stutzig ^^


    ich fragte mich was an windows oldschool backslashes korrekt sei und fand dabei heraus das die str_replace funktion nicht wie beschreiben funktioniert


    mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )
    Quelle


    so nun...
    str_replace für dummies :)
    nach dem ersten wird im dritten gesucht und mit dem zweiten ersetzt
    str_replace ( erstes, zweites, drittes)


    das würde ja bedeuten das die beiden pfadangaben, vertauscht wurden und die geschichte für windows ( ich bin macuser ) user ist, deren pfadangaben nicht mit ulr-pfadangaben übereinstimmen, aufgrund der backslashes.



    stimmt das jetzt?


    und falls nicht kann mir jemand mein brett vor dem kopf entfernen :)


    gruß
    peter

    Eine andere Möglichkeit :D


    Dem internen Link zur Startseit eine Variable anhängen.


    <!-- m --><a class="postlink" href="http://startseite.php?nichtnocheinmal=abjetzt">http://startseite.php?nichtnocheinmal=abjetzt</a><!-- m -->
    also

    Code
    <a href='startseite?nichtnocheinmal=abjetzt>home</a>


    und über deine js-Anweisung stülpst du

    Code
    <span class="syntaxhtml"><br /><span class="syntaxdefault"><?php if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$_GET</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'nichtnocheinmal'</span><span class="syntaxkeyword">]!=</span><span class="syntaxstring">'abjetzt'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">:</span><span class="syntaxdefault"> ?><br /></span><br />/*hier dein JS*/<br /> <br /><span class="syntaxdefault"><?php endif</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> ?><br /></span></span>


    Gruß
    peter

    Zitat von &quot;Sören&quot;

    ist das gleiche, wie:

    Code
    <span class="syntaxdefault">ALLES AUSWÄHLEN<br /><br />$sql </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">" INSERT INTO gaestebuch<br />             SET /* nicht dafür gedacht - VALUE besser */<br />              id   = '$_POST['id'] ',<br />              name   = '$_POST['name']',<br />              email  = '$_POST['email']',<br />              url    = '$_POST['url']',<br />              datum  = '$date', <br />              eintrag='$_POST['eintrag']' "</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> </span>


    SET wird verwendet um Variablen zu überschreiben



    undhier noch


    Gruß
    peter

    Code
    <span class="syntaxdefault">$value </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 1</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">$fill   </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">" ,"</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">while </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> $value </span><span class="syntaxkeyword"><=</span><span class="syntaxdefault"> 12 </span><span class="syntaxkeyword">)<br />{<br /></span><span class="syntaxdefault">    echo $value</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">    echo $fill</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">         $value</span><span class="syntaxkeyword">++;<br /></span><span class="syntaxdefault">    if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> $value </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> 12 </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">        $fill</span><span class="syntaxkeyword">=</span><span class="syntaxstring">" "</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">}<br />}</span><span class="syntaxdefault"> </span>


    Gruß Peter

    @Sarrkan


    sry, das ist wieder typisch ich :)


    ich mag php-einfach nicht
    habe ich anders verstanden 0o ich hab mich schon über den bindestrich gewundert! ^^


    dabei steht im ersten post ja der link zu der seite +-+


    gruß
    peter

    Zitat von &quot;Sarrkan&quot;

    Naja.. im Normalfalle sollte es dir doch auffallen, ob du eine Variabel definiert hast.
    Spätestens, wenn dir eine Funktion meldet, dass die Variabel Leer ist, oder am ende nichts raus kommt, sollte man Hellhörig werden ;)


    ja ist logisch


    nur
    damals funktionierte mein script local einwandfrei


    und als ich es hochlud
    auch


    nur diese Fehlermeldung oder besser notice war dabei - undefined variable und kein zugriff auf die .ini


    ich kann es sicher mit einer abfrage umgehen
    so das die variable nur gesetzt wird wenn ich sie wirklich brauche


    fiel mir local mit eingeschränktem error_reporting jedoch nicht auf


    so ist das :)



    nun nehm ich das gesamte packet und frage in jedem value mit !empty() ab


    danke euch beiden für eure anregungen
    habt mir sehr geholfen :D


    lg


    ____________________________________________________________
    EDIT
    ____________________________________________________________


    frage jetzt mit !empty den absende button ab
    falls der leer ist wird ein formular ohne den $_GET['xxx'] angezeigt
    falls das formular gesendet wurde wird das formular mit den $_GET['xxx'] aufgerufen
    weil die nicht mehr NULL sind , sondern ein leerer string also defined

    mh..


    wenn ich im value die variable weglasse habe ich ein problem wie sarrkan schon sagt


    nehmen wir an ich hab mehrere felder
    diese sollen alle ausgefüllt sein ( numerisch, etc geprüft ) bevor die berechnung startet


    wenn ich den wert nicht von der url mit get/post hole muss der user alles noch einmal eingeben
    und das geht heute echt nicht mehr :)


    es muss fast eine einstellung geben welche
    undefined index nicht anzeigt
    und
    undefined variables anzeigt



    auf meinem serverplatz vom freehoster bplaced werden die e_notice nicht angezeigt ^^


    lg

    local im browser getestet


    error_reporting() mh schade
    einen fehler zu beheben, in dem ich die meldung wegschalte...



    _______________
    EDIT
    _______________
    aber wenn ich das script auf den server lade wird die fehlermeldung nicht angezeigt ^^
    muss mit den einstellungen der php.ini zu tun haben


    ob man error_reporting gezielt einstellen kann werde ich mir durchlesen!