Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Connection issues related to the LoginPHPMySQL #142

Open
infyProductions opened this issue Aug 25, 2021 · 0 comments
Open

PHP Connection issues related to the LoginPHPMySQL #142

infyProductions opened this issue Aug 25, 2021 · 0 comments

Comments

@infyProductions
Copy link

I had a lot of database connection issues while trying out this project. After I started XAMMP (with Apache and MySQL only) and trying to run the application. The android part of the tutorial works but when I tried to connect my phone (as a test device) to the webserver hosted on my machine, it returns an error pertaining to "Unable to retrieve any data from server".

I tried browsing on http://localhost/test_android/index.php when it returned an error like:
Fatal error: Uncaught ArgumentCountError: mysqli_connect_errno() expects exactly 0 arguments, 1 given in D:\XAMPP\htdocs\test_android\db-connect.php:13 Stack trace: #0 D:\XAMPP\htdocs\test_android\db-connect.php(13): mysqli_connect_errno(Object(mysqli)) #1 D:\XAMPP\htdocs\test_android\user.php(12): DbConnect->__construct() #2 D:\XAMPP\htdocs\test_android\index.php(31): User->__construct() #3 {main} thrown in D:\XAMPP\htdocs\test_android\db-connect.php on line 13

I also checked the logcat logs of the app and it returned a similar error like the one on the top:
E/API123: 200
D/API123:

Fatal error: Uncaught ArgumentCountError: mysqli_connect_errno() expects exactly 0 arguments, 1 given in D:\XAMPP\htdocs\test_android\db-connect.php:13
Stack trace:
#0 D:\XAMPP\htdocs\test_android\db-connect.php(13): mysqli_connect_errno(Object(mysqli))
#1 D:\XAMPP\htdocs\test_android\user.php(12): DbConnect->__construct()
#2 D:\XAMPP\htdocs\test_android\index.php(31): User->__construct()
#3 {main}
thrown in D:\XAMPP\htdocs\test_android\db-connect.php on line 13

E/JSON Parser: Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject

I checked the questionable line and it looks like this:
Line 13: if (mysqli_connect_errno($this->connect)){
Line 14: echo "Unable to connect to MySQL Database: " . mysqli_connect_error();
Line 15: }

I used the default credentials on XAMMP with the DB_HOST set as localhost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant