Abfragen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Abfragen

    Also ich programmier grade ein etwas größeres Script aber nun habe ich so viele while schleifen das ich selber nicht mehr den überblick bewahre.

    Ein kleines Sample :
    PHP Code:
    $sql=("Select id,vorname,nachname,nick,pass,url,mail,status,DATE_FORMAT(anmeldung, '%d.%m.%Y %H:%i') anmeldung_formated from t_user where nick like '$username'"); 
    echo"blabla";
    }

    Naürlich verwende ich den Inhalt aber manchmal muss ich mit 4 Schleifen beenden. Deswegen wollte ich fragen ob es da ne bessere möglichkeit gibt.

  • #2
    ich verstehe nicht. dein kleines samples beinhaltet eine abfrage.

    und wo sind schleifen im spiel?
    INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


    Comment


    • #3
      Ja aber davon hab ich bisher schon 4 oder 5 und der Code wird völlig unübersichtlich wegen den }

      Comment


      • #4
        ach das ist dein problem? hast du es schon mit einrücken versucht?
        INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


        Comment


        • #5
          Wie meinst du das?
          bzw.
          Was versteht man da drunter

          Comment


          • #6
            du schreibst wahrscheinlich so deinen code.
            PHP Code:
            while (....) {
            while (....) {
            while (....) {
            while (....) {
            }
            }
            }

            und eingerückt würde das dann so aussehen.

            PHP Code:
            while (....) { // start while 1

              
            while (....) { // start while 2

                
            while (....) { // start while 3

                  
            while (....) { // start while 4

                  
            // end while 4

                
            // end while 3

              
            // end while 2

            // end while 1 
            sieht irgendwie übersichtlicher aus, meinst du nicht?
            INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


            Comment


            • #7
              Ok danke da hasste recht.


              Werde gleich mal alles ordnen

              Comment


              • #8
                übrigens ist das einrücken eine GRUNDVORAUSSETZUNG zum sauberen coden.
                INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                Comment


                • #9
                  Jo ich weis und deswegen werde ich auch langsam damit anfangen

                  Comment


                  • #10
                    ich würde das nicht langsam , sondern eher SCHNELL machen.


                    btw. im sql ist der thread nicht gut aufgehoben.

                    *VERSCHIEB* nach php
                    INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                    Comment

                    Working...
                    X