i'm new in android i'll put my code tell me please what i am wrong php dont save any data im mysql database in localhost(wamp server)
here is connect.php code:
<?php
$server="127.0.0.1";
$user="root";
$pass="";
$dbname="mydb";
$dsn="mysql:host=$server;port=3306;dbname=$dbname";
try{
$connect=new PDO($dsn,$user,$pass);
$connect->exec("set character_set_connection='utf8'");
$connect->exec("set name='utf8'");
if($connect){
echo "the connection is fine";
}
}catch(PDOException $error){
echo"unable to connect".$error->getmessage();
}
here is the code for insert into table
<?php
include "connect.php";
if (isset($_POST["add"])){
$name=$_POST["name"];
$des=$_POST["des"];
$price=$_POST["price"];
$cat=$_POST["cat"];
$image=$_POST["image"];
$query_insert="insert into cell (name,des,price,cat,image) values (:name,:des,:price,:cat,:image);";
$result=$connect->prepare($query_insert);
$result->bindparam(":name",$name);
$result->bindparam(":des",$des);
$result->bindparam(":price",$price);
$result->bindparam(":cat",$cat);
$result->bindparam(":image",$image);
$result->execute();
echo mysql_error();
echo"yes";
}
?>