0

我正在尝试执行以下代码。但收到此错误:“mysql_result() [function.mysql-result]: Unable to jump to row 1 on MySQL result index 5”,第 0 个索引处的值被打印但剩余给出上述错误。我的代码是:

$s = mysql_query( "SELECT USER_NAME, LOCATION, LANGUAGE, PHONE FROM USERS WHERE USER_ID = '$userid'" );
    if(mysql_fetch_row( $s ) ){
        $username = mysql_result( $s, 0 );
        $location = mysql_result( $s, 1 );
        $language = mysql_result( $s, 2 );
        $phoneNum = mysql_result( $s, 3 );

    echo $username;
    echo $location;
    echo $language;
    echo $phoneNum;
}

任何人都可以解释错误。

4

1 回答 1

0
$s = mysql_query( "SELECT USER_NAME, LOCATION, LANGUAGE, PHONE FROM USERS WHERE USER_ID = '$userid'" );

$row    = mysql_fetch_row($s);
    if($row){
        $username = $row[0];
        $location = $row[1];
        $language = $row[2];
        $phoneNum = $row[3];

    echo $username;
    echo $location;
    echo $language;
    echo $phoneNum;

}
于 2013-11-11T06:55:17.923 回答