Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i Post the data in QtCreator?
    primarykey
    data
    text
    <p>Here is my code of Qt creator to send the data to PHP server and get the response.</p> <pre><code>QNetworkAccessManager *manager = new QNetworkAccessManager(this); QNetworkAccessManager::connect(manager, SIGNAL(finished(QNetworkReply*)),this , SLOT(replyFinished(QNetworkReply*))); QNetworkRequest *request = new QNetworkRequest(QUrl("http://68.169.55.41/fss/verifylogindetails.php")); QByteArray postData =" {\"estate_id\":\"hsr\",\"emp_pin\":1234,\"emp_id\":\"santhosh\"}"; request-&gt;setRawHeader( "User-Agent" , "Mozilla Firefox" ); request-&gt;setRawHeader( "charset", "utf-8" ); request-&gt;setRawHeader( "Connection", "keep-alive" ); manager-&gt;post(*request, postData ); } void MainWindow::replyFinished(QNetworkReply *reply) { QString data = reply-&gt;readAll().trimmed(); qDebug() &lt;&lt; data; } </code></pre> <p>And here is my php code to receive the login data and comparing with database values and sending the response.</p> <pre><code>&lt;?php include 'config.php'; $data = json_decode($_SERVER['HTTP_JSON']); $con = mysql_connect($host, $user_name, $password); if (!$con) { die('Could not connect: '.mysql_error()); } mysql_select_db($db_name, $con); $result = mysql_query("SELECT * FROM login_data_table"); while($row = mysql_fetch_array($result)) { if((strcasecmp( $row['Emp_Id'], $data-&gt;emp_id) == 0) &amp;&amp; ($row['Emp_Pin'] == $data- &gt;emp_pin) &amp;&amp; (strcasecmp( $row['Estate_Id'], $data-&gt;estate_id) == 0)) { echo "SUCCESS"; } else { echo "FAIL"; } } mysql_close($con); ?&gt; </code></pre> <p>My problem is..... Always i am getting FAIL message from server. Even i am sending correct login details. please help me where i am wrong in my code.</p>
    singulars
    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.
 

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