SOLVED: I missed second equal sign in the if test making it an assignement... :-(
Hi all,
can you please help with the following code?
This snippet show a "strange" unexpected behaviour since posting user=2&action=1 shows values correctly before the if statement and renders $user2 as 1 right after the if.
What's wrong with it?
To post test data I use
TIA
Umberto
Hi all,
can you please help with the following code?
B4X:
<?php
include('app_conn.php');
$rawdata1 = file_get_contents("php://input"); // user=X&action=Y
parse_str($rawdata1,$myarray); //user=x; action=y
$user2 = mysqli_real_escape_string($link,$myarray['user']); //secure it
$action = $myarray['action'];
$giorno= date("Y-m-d"); //today
header("HTTP/1.1 500 Internal Server Error");
echo ' rawdata: '.$rawdata1;
print_r($myarray);
echo ' action:'.$action;
echo ' user: '.$user2;
echo ' giorno: '.$giorno; //everything ok up until this point
if ($user2 = "1")
{$giorno = "2013-12-10";} //use specific date for user=1
echo ' user: '.$user2; //wrong user!! user = 2 becomes user = 1 ????
echo ' giorno: '.$giorno;
exit;
...
What's wrong with it?
To post test data I use
B4X:
ExecuteRemoteQuery("user=2&action=1",XYZ)
..
Sub ExecuteRemoteQuery(Query As String, JobName As String)
job.PostString("http://mytestsite.com/test01.php",Query)
TIA
Umberto
Last edited: