i am having php code like below
<?php
/* $host='127.0.0.1';
$uname='root';
$pwd='password';
$db="android";
*/
require_once('dbConnect.php');
/* $con = mysql_connect($host,$uname,$pwd) or die("connection failed");
mysql_select_db($db,$con) or die("db selection failed");
*/
$id=$_REQUEST['id'];
$approval=$_REQUEST['approval'];
$flag['code']=0;
$sql = "UPDATE ap_events SET event_approval = '$approval' WHERE id ='$id'";
if($r=mysqli_query($sql,$con))
{
$flag['code']=1;
}
print(json_encode($flag));
// mysql_close($con);
mysqli_close($con);
?>
but i want to remove the hostname username and password details from the above code, for the same i have another dbConnect.php code below:
<?php
define('HOST','localhost');
define('USER','root');
define('PASS','password');
define('DB','android');
$con = mysqli_connect(HOST,USER,PASS,DB) or die('Unable to Connect');
producing results always code = 0 means unsuccessful. and when i remove the comments it is successful!!