Android Question Connecting to mysql Database

brianwiz12

Active Member
Licensed User
Longtime User
Hello,

Just trying to do a simple mysql connection (using the mysql tutorial from Erel.

Im getting the following

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: Handshake failed, Response:
javax.net.ssl.SSLHandshakeException: Handshake failed

I put the PHP file in the public_html file.
I confirmed the Database name, username, password and localhost is correct.

I confirmed in the php is set for mysqli_set_charset ($con , "utf8");

<?php

$databasehost = "localhost";
$databasename = "ultim168_TVTrivia";
$databaseusername ="username";
$databasepassword = "password";

$con = mysqli_connect($databasehost,$databaseusername,$databasepassword, $databasename) or die(mysqli_error($con));
mysqli_set_charset ($con , "utf8");
$query = file_get_contents("php://input");
$sth = mysqli_query($con, $query);

if (mysqli_errno($con)) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysqli_error($con);
}
else
{
$rows = array();
while($r = mysqli_fetch_assoc($sth)) {
$rows[] = $r;
}
$res = json_encode($rows);
echo $res;
mysqli_free_result($sth);
}
mysqli_close($con);
?>
 

teddybear

Well-Known Member
Licensed User
Is it your app or php script connecting to database?
 
Upvote 0
Top