string vergleich schlägt fehl

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

  • string vergleich schlägt fehl

    $val & $s sind die gleichen werte die if bedingung trifft aber niemals zu. was ist falsch?

    PHP Code:
            for ($i 0$i $tables$i++) 
            {
                
    $s mysql_tablename($tables$i) . "\n";                
                if (
    $val == $s) echo ("<OPTION Selected>$s");
                else echo (
    "<OPTION>$s");
            } 
    EDIT:
    PHP Code:
            <?php
            $tables 
    mysql_list_tables($mysqldb$db);
            
    $val $HTTP_POST_VARS['menue_set1'];
            for (
    $i 0$i $tables$i++) 
            {
                
    $s mysql_tablename($tables$i) . "\n";                
                if (
    $val == $s) echo ("<OPTION Selected>$s");
                else echo (
    "<OPTION>$s");
            }
            
            
    ?>

    Last edited by 3-yl; 16-06-2004, 13:42.

  • #2
    Du hast nirgends $val definiert?

    Comment


    • #3
      1. wo wird $val definiert?

      2. hast du $val und $s auch mal als ausgabe getestet?

      denn der inhalt muss nach deinen schilderungen definitiv nicht gleich sein.
      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


      • #4
        ich habe das als ausgabe getestet, sieht identisch aus.

        PHP Code:
            <select name="menue_set1" id="menue_set1">
                
                <?php
                $tables 
        mysql_list_tables($mysqldb$db);
                
        $val $HTTP_POST_VARS['menue_set1'];
                for (
        $i 0$i $tables$i++) 
                {
                    
        $s mysql_tablename($tables$i) . "\n";                
                    if (
        $val == $s) echo ("<OPTION Selected>$s");
                    else echo (
        "<OPTION>$s");
                }
                
                
        ?>
                
            </select>
        gesammter code abschnitt.

        Comment


        • #5
          sieht identisch aus.
          sehr witzig! kannst du das mal konkretisieren? var_dump?
          Die Zeit hat ihre Kinder längst gefressen

          Comment


          • #6
            Original geschrieben von derHund
            var_dump?
            kannst du das mal konkretisieren?

            Comment


            • #7
              www.php.net/var_dump
              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


              • #8
                war ein zeilenumbruch

                PHP Code:
                        <?php
                        $tables 
                mysql_list_tables($mysqldb$db);
                        
                $val $HTTP_POST_VARS['menue_set1'];
                        for (
                $i 0$i $tables$i++) 
                        {
                            
                $s mysql_tablename($tables$i);                
                            if (
                $val == $s) echo ("<OPTION Selected>$s");
                            else echo (
                "<OPTION>$s");
                        }
                        
                        
                ?>

                Comment


                • #9
                  OffTopic:
                  var_dump fetzt, nicht wahr?
                  Die Zeit hat ihre Kinder längst gefressen

                  Comment


                  • #10
                    scho, fett krass...

                    Comment

                    Working...