简体   繁体   中英

React native connect to local database with php and axios

I'm having a problem connecting the front-end to the back-end through PHP. The database is connected with PHP but not the front-end, and when I run it on the Postman, it prints out 500 internal server error.

    axios
      .get(Api, {
        params: {
          route: "extension/account/purpletree_multivendor/api/sellers",
          language_id: this.props.language,
          search_text: this.state.searchTxt.toUpperCase(),
          category_id: categoryId.toString(),
          geocode: geocode,
        },
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => {
        //handle no seach item
        if (res.data.success) {
          if (res.data.message !== "No Data") {
            this.setState({
              sellers: res.data.data.sellers,
              isLoading: false,
            });
          } else {
            this.setState({ isLoading: false, showMessage: true });
          }
        } else {
          //show error message
          this.setState({ isLoading: false });
        }
      });

Thank you for answering this question, I have asked an instructor of mine and figured:

  1. I did not turn on the display_errors in php.ini
  2. After turning it on it prints out the detailed error, which is some of my database tables are missing, so it won't be able to run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM