This is for my Android application. I have two tables in my database. I am able to insert the values into the table using a php file (url.php). I use different php file (table.php) for comparing the two tables. However when I run the file in the browser I am getting response for url.php but a blank page for table.php.
I have no issues while doing this on a localhost but when its on a server its not working.
PS: The connections are all correct. I have not specified the hostname and other details here. Does it have to do anything with the usage of mysql or mysqli. Here is the code for url.php
<?php
$hostname = "";
$username = "";
$password = "";
$dbname = "";
$con = mysqli_connect($hostname,$username,$password,$dbname);
$unique_id = $_POST['unique_id'];
$link = $_POST['link'];
$sent = $_POST['sent'];
$Sql_Query = "insert into downloads (unique_id,link,sent) values ('$unique_id','$link','$sent')";
if(mysqli_query($con,$Sql_Query)){
echo 'Data Inserted Successfully';
}
else{
echo 'Try Again';
}
mysqli_close($con);
?>
Here is the code for table.php
<?php
header('Content-type: application/json');
$hostname = "";
$username = "";
$password = "";
$dbname = "";
mysql_connect("$hostname", "$username", "$password") or die("cannot connect");
mysql_select_db("$dbname");
$sent = $_GET['sent'];
$sql=mysql_query("SELECT d.unique_id, u.name FROM downloads d LEFT JOIN users u ON u.name = d.unique_id WHERE d.link = '{$sent}'");
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
json_encode($output);
print(json_encode($output));
mysql_close();
?>