I got two files name func.inc.php and profile.php
I’m trying to fetch the data from the mysql by creating a function get_data($id) in func.inc.php and display in the profile page(profile.php).But the data is not displaying.
<– func.inc.php file –>
<?php session_start();
function get_data($id){
$query_in="SELECT * FROM user WHERE id ='$id'";
$query=mysql_query($query_in);
while($row=mysql_fetch_assoc($query)){
$name=$row['name'];
$book=$row['book'];
$mobile=$row['mobile'];
$computer=$row['computer'];
}
}
?>
<– profile.php –>
<?
include'func.inc.php';
echo "Name: ".$name;
echo "Book: ".$book;?>
The function should return some value then only the values from the function will be got
<– profile.php –>