Florian P. wrote:
<?php

include("sql.inc.php");
include("config.inc.php");

$connection = mysql_connect($sql['host'],$sql['uid'],$sql['pwd']);
$select_db = mysql_select_db($sql['db']);

$select = mysql_query('SELECT * FROM comments');
$data = mysql_fetch_array($select);

$result = mysql_query('SELECT * FROM comments');
$rows = mysql_num_rows($result);
<snip>

No reason to run this twice....

$data = array();
if ( $result = mysql_query ( 'SELECT * FROM comments' ) ) {
        while ( $temp = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
                $data[] = $temp;
        }
        $rows = mysql_num_rows ( $result );
        mysql_free_result ( $result );
} else {
        echo ( mysql_error() );
        exit;
}

The returned rows will be in the $data array.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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

Reply via email to