Hi,

        I have a code that goes like this. Scroll down to the "<----------"
sign. How come I need another $result = mysql_query($sql) at that location?
If I don't have it, the results coming out will only start printing from the
2nd Row.. Omitting the 1st.

Results as wanted 

row 1           value1
row 2           value2
row 3   value3

Getting this instead

row 2           value2
row 3   value3

????

Pls Help.

        $result = mysql_query($sql);

        $num_results = mysql_num_rows($result);

        $row = mysql_fetch_row($result);
        
        echo '<p><h4>There are ' . $num_results; 
        echo ' FA entries found</p></h4>' . "\n";
        
        echo '<table border="2" cellpadding="5">' . "\n";
        echo '<td colspan="' . sizeof($row) . '" align="center" >';
        echo '</td>' . "\n";

# ===========================
# Print out the Table Field Names
# ===========================
        echo '<!-- Results Table Header Field Names -->';
        echo "\n";
        echo '<tr>' . "\n";
        
        for ($k = 0; $k < sizeof($row) ; $k++)
        {
                echo "\t" . '<td>';
                echo mysql_field_name($result,$k);
                echo "</td> \n";
        }

# ===========================
# Print out the Table Results
# ===========================
        
        $result = mysql_query($sql);   <---------------======WHY Is THIS
needed????

        for ($i = 0; $i < $num_results ; $i++)
        {
                echo "<tr>\n"  ;
                $row = mysql_fetch_row($result);
                for ($j = 0; $j < 12 ; $j++)
                {
                        echo "\t" . '<td>';
                        echo  $row[$j] ;
                        echo "</td> \n";
                }

                echo "</tr>\n";
        }
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to