Justtechjobs.com Find a programming school near you






Online Campus Both


php-developer-list | 2001041

[PHP-DEV] Bug #10341: mysql_fetch_object, $row->0 produces parse error From: francis <email protected>
Date: 04/15/01

From: francis <email protected>
Operating system: Win 2000
PHP version: 4.0.4pl1
PHP Bug Type: MySQL related
Bug description: mysql_fetch_object, $row-&gt;0 produces parse error

The script:

mysql_pconnect ($dbhost, $dbuser, $dbpass);
$result = mysql_db_query ("database", "select * from tablename");
while ($row = mysql_fetch_object ($result, MYSQL_NUM)) {
    echo $row->0;
    echo $row->1;
}
mysql_free_result ($result);

Generates the error:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'{'' or `'$'' in d:/htdocs/assets/includes/hs~form_functions.php on line 31

The script below works but not for the general case (different column names):

mysql_pconnect ($dbhost, $dbuser, $dbpass);
$result = mysql_db_query ("database", "select * from tablename");
while ($row = mysql_fetch_object ($result, MYSQL_ASSOC)) {
    echo $row->columnone;
    echo $row->columntwo;
}
mysql_free_result ($result);

-- 
Edit Bug report at: http://bugs.php.net/?id=10341&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>