hi!
I have a problem.
I 'm trying to post variables into a database from b4a using HttpJob
and here's my php script
the problem is when I click on send, I get this 'Error: Internal Server Error' I thinks something's wrong with my script but I don't know what's wrong
any idea? thank you
I have a problem.
I 'm trying to post variables into a database from b4a using HttpJob
B4X:
Sub send_Click
name = nam.Text
orig = orig.Text
opi = op.Text
Dim job1 As HttpJob
job1.Initialize("Job1", Me)
job1.PostString("http://192.168.1.64/obtain.php", "name='" & name & "', orig='" & orig & "', state='" & state & "', opi='" & opi & "'")
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Log(Job.GetString)
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
and here's my php script
B4X:
<?php
$servername = "localhost";
$username = "root";
$password = "1234";
$dbname = "visitors";
$conn = new mysqli($servername,$username,$password,$dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$name = $_GET('name');
$orig = $_GET('orig');
$state = $_GET('state');
$opi = $_GET('opi');
$sql = "INSERT INTO mytable(NV, name, orig, state, opi) VALUES(1,'"$name"', '"$orig"', '"$state"', '"$opi"')"
if($conn->query($sql)===TRUE){
echo "SUCCESS!";
}else{
echo "ERROR"
}
$conn->close();
?>
the problem is when I click on send, I get this 'Error: Internal Server Error' I thinks something's wrong with my script but I don't know what's wrong
any idea? thank you