Linked Questions

Popular Questions

undefined variable in PHP function

Asked by At

I used a ins function to insert in data base and i create a object for mysqli.The mysqli object shows error of undefined variable.and my code was

include "config.php";
global $mysqli;
 $mysqli = &new mysqli($host, $db_user, $db_pass, $db);
function ins($name)
 $stmt=$mysqli->prepare("insert into table demo values(?)");

Here the server name ,user name password and db name are stored in config.php

Related Questions