doujuanxun7167 2019-01-30 22:57
浏览 55

我怎么知道用户是否登录反应原生并将数据传递给listview + php

how can i know if the user is logged in react native and pass data to listview + php

I can't pass the data from the logged-in user to the react native.

    return fetch('https://entregas24.000webhostapp.com/viewData.php')
      .then((response) => response.json())
      .then((responseJson) => {
        let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})
        this.setState({
          isLoading: false,
          dataSource: ds.cloneWithRows(responseJson),
        }, function() { 
        });
      })
      .catch((error) => {
        console.error(error);
      });
  }

  viewUsers=(email, firstName, lastName)=>{

       this.props.navigation.navigate('Third', {
         email : email,
         firstName : firstName,
         lastName : lastName,
       });
  }

   return (
       <ListView

         dataSource={this.state.dataSource}

         renderSeparator= {this.ListViewItemSeparator}

         renderRow={ (rowData) => <Text style={styles.rowViewContainer}

                   onPress={this.viewUsers.bind(
                     this,
                      rowData.email,
                      rowData.firstName,
                      rowData.lastName,
                      )} >

                   {rowData.email}

                   </Text> }
       />

     </View>
   );
 }

For now I'm even just trying to show the data and than edit them. So if someone can help me i really appreciate.

public function viewUser($email, $firstName, $lastName){

            $userData = array();
            $result = $this->connect()->prepare( "SELECT email, firstName, lastName FROM `users` ");
            $result->execute();
            $number_of_rows = $result->fetchColumn();
            if($number_of_rows > 0) {
                while($row = $result->fetch(PDO::FETCH_OBJ)){
                    echo $row['email'];
                }
            }
        } 
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 linux驱动,linux应用,多线程
    • ¥20 我要一个分身加定位两个功能的安卓app
    • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
    • ¥15 IAR程序莫名变量多重定义
    • ¥15 (标签-UDP|关键词-client)
    • ¥15 关于库卡officelite无法与虚拟机通讯的问题
    • ¥15 目标检测项目无法读取视频
    • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
    • ¥100 求采集电商背景音乐的方法
    • ¥15 数学建模竞赛求指导帮助