0

I have created android app with login and logout functionality which saves data to remote database. the problem is when I try to save data it don't work.

then I checked whether I can save data in my php database .. so I found error on my php page..

Register.php

<?php
$con=mysqli_connect("mysql8.000webhost.com" , "---" , "passhere" , "---");

$name = $_POST["name"];
$email = $_POST["email"];
$age=$_POST["age"];
$username = $_POST["username"];
$password = $_POST["password"];
$date = $_POST["date"];
$time = $_POST["time"];

$statement = mysqli_prepare($con, "INSERT INTO check(name,email,age,username,password,date,time) VALUES (?,?,?,?,?,?,?) ");
mysqli_stmt_bind_param($statement, "ssissss" , $name, $email , $age , $username , $password, $date, $time);
mysqli_stmt_execute($statement);
mysqli_close($con);
?>

This is the error:

Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /home/a9447544/public_html/test/Register.php on line 13


Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /home/a9447544/public_html/test/Register.php on line 14

you can check it yourself at:

http://funvilla.in/test/Register.php?name=abc&email=abc&age=2&username=gnjf&password=fdfg&date=4jn4j5&time=938434h3h
  • http://php.net/manual/en/mysqli.error.php use that against your query. You'll see the syntax errors you're making. – Funk Forty Niner Jul 30 '15 at 12:26
  • You're also using POST arrays but a GET method in your HTML form. Error reporting would have caught that. http://php.net/manual/en/function.error-reporting.php and you really shouldn't be passing passwords in a URL or anything else for that matter. – Funk Forty Niner Jul 30 '15 at 12:28
  • Thanks bro check was a keywork so I use backticks as `check` – Akshay Sood Jul 30 '15 at 12:30
  • You're welcome. As are `name`, `password` and `time` - Here is the full list https://dev.mysql.com/doc/refman/5.5/en/keywords.html – Funk Forty Niner Jul 30 '15 at 12:32

0 Answers0