Hi all, when i try to do this:
EjecutaConsultaRemota("insert into FuncionDiaria (IdFuncionDiaria, Fecha, IdOperario, IdFuncion) values (" & Registro.Get("idfunciondiaria") & ", '" & Registro.Get("fecha") & "'," & Registro.Get("idoperario") & "," & Registro.Get("idfuncion") & ")" , SUBIR_FUNCION)
Sub EjecutaConsultaRemota(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("http://???/conexion_android.php", Query)
Log("Sentencia SQL: " & Query)
End Sub
I obtain this Warning:
Response from server: <br />
<b>Warning</b>: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in <b>/home/.../conexion_android.php</b> on line <b>22</b><br />
And in sub JobDone(Job As HttpJob) i obtain an error and app dies:
java.lang.RuntimeException: JSON Array expected.
This is conexion_android.php:
<?php
$databasehost = "localhost";
$databasename = "moqowpkk_???????";
$databaseusername ="moqowpkk_????";
$databasepassword = "???????";
$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
$query = file_get_contents("php://input");
$sth = mysql_query($query);
if (mysql_errno()) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysql_error();
}
else
{
$rows = array();
while($r = mysql_fetch_assoc($sth)) { --> THIS IS LINE 22
$rows[] = $r;
}
print json_encode($rows);
}
?>
I don'w know how to solve this problem, can someone help me?
Anyway record is inserted but app fails.
If i make a Select query works fin.
Thanks in advance.
EjecutaConsultaRemota("insert into FuncionDiaria (IdFuncionDiaria, Fecha, IdOperario, IdFuncion) values (" & Registro.Get("idfunciondiaria") & ", '" & Registro.Get("fecha") & "'," & Registro.Get("idoperario") & "," & Registro.Get("idfuncion") & ")" , SUBIR_FUNCION)
Sub EjecutaConsultaRemota(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("http://???/conexion_android.php", Query)
Log("Sentencia SQL: " & Query)
End Sub
I obtain this Warning:
Response from server: <br />
<b>Warning</b>: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in <b>/home/.../conexion_android.php</b> on line <b>22</b><br />
And in sub JobDone(Job As HttpJob) i obtain an error and app dies:
java.lang.RuntimeException: JSON Array expected.
This is conexion_android.php:
<?php
$databasehost = "localhost";
$databasename = "moqowpkk_???????";
$databaseusername ="moqowpkk_????";
$databasepassword = "???????";
$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
$query = file_get_contents("php://input");
$sth = mysql_query($query);
if (mysql_errno()) {
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysql_error();
}
else
{
$rows = array();
while($r = mysql_fetch_assoc($sth)) { --> THIS IS LINE 22
$rows[] = $r;
}
print json_encode($rows);
}
?>
I don'w know how to solve this problem, can someone help me?
Anyway record is inserted but app fails.
If i make a Select query works fin.
Thanks in advance.