Page 1 of 1

Newbie. please help![Solved]

Posted: Sun Jun 19, 2005 9:12 pm
by nexus6
This is from my index.php. it has a "onclick open row" javascript
to it. These 2 codes seems very similar. I would like to merge these 2 codes so
i still can use my open row javascript. Is it something with the 'class=header' from my selecttable.php, that should be moved to my index.php code? if so how?

Code: Select all

$class = "";
   if ($count % 2 == 0) {
      $class = "row index" .$count. " even";
	} else {
      $class = "row index" .$count. " odd";
	}
       echo "<TR id=\"$row[0]\" class=\"$class\">\n";
         echo "\t<TD class=\"first\">$count</TD>\n";
            for ( $i = 0; $i <= sqlite_num_fields($result)-1; $i += 1) {
             echo "\t<TD class=\"cell\">$row[$i]</TD>\n";
	     }
          echo "</TR>\n";
       $count++;
      }
    }
    sqlite_close($handle);
echo "<!-- End table rows -->\n";
This is from my selecttable.php. this dont support my "open row" script.

Code: Select all

if (sqlite_num_rows($result) >0) {
      $count	= 0;
          echo "<TABLE cellspacing=0 cellpadding=0>";
             while($row = sqlite_fetch_array($result)) {
   if ($count == 0) {
       echo "<TR class=\"header\">\n";
          echo "\t<TH class=\"first\">#</TD>\n";
            for ( $i = 0; $i <= sqlite_num_fields($result)-1; $i += 1) {
              echo "\t<TH>" .sqlite_field_name($result, $i). "</TH>\n";
	      }
         echo "</TR>\n";
	}
echo "</TABLE>";