Note that there are some explanatory texts on larger screens.

plurals
  1. POHow send and catch data from php to android device?
    primarykey
    data
    text
    <p>hii i am made the following code for my website which works perfectly well but i am now working on the android version and tried to catch the resposnse from php script which not working well</p> <p>Code for website</p> <pre><code>&lt;?php include('config.php'); $link =mysql_connect($db_host,$username,$password); mysql_select_db($db_name); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $sql="SELECT * FROM logintbl WHERE stu_email='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_start(); $_SESSION['username'] = $myusername; $_SESSION['password'] = $mypassword; header("location:login_success.php"); } else { header('Location: http://www.xxxxxxx.com/pabrowser/index.php?succmsg1=INVALID.RETRY'); } ?&gt; </code></pre> <p>the code changed to work with android device</p> <pre><code>&lt;?php $link = mysql_connect(xxxxxxxx); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db("brainoidultrafb", $link); $sql="SELECT * FROM logintbl WHERE stu_email='".$_REQUEST['id']."' and password='".$_REQUEST['pass']."'"; $result=mysql_query($sql); $count=mysql_num_rows($result); $output[]=$count; print(json_encode($output)); mysql_close(); ?&gt; </code></pre> <p>the output should be either 0 or 1 which will allow the device to login .</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload