Can we call an variable and function directly when we include an file in php -
dbc.php
<?php $con = mysqli_connect("****", "****", "****", "employees"); if(!$con) { echo "connection error"; die(); } ?>
index.php
<?php require("dbc.php"); $query = mysqli_query($con, "select * uname"); //error : undefined $con if(!$query) { echo "query error"; die(); } ?>
how can call variables , functions when include file. why above declared $con showing error?
wiki
Comments
Post a Comment