I want to create a php function that i can use to get a particular user details and display the info gotten in my ProfileActivity when a user profile is been clicked in my app. so i wrote this php code to get user details from my database but when i run the code nothing is returned in my browser. please what could be causing this?
<?php
require("config.php");
function getdetails($id)
{
$array = array();
$q = mysql_query("SELECT * FROM 'users' WHERE 'id'=".$id);
while($r = mysql_fetch_assoc($q))
{
$array['id'] = $r['id'];
$array['name'] = $r['name'];
}
return $array;
}
function getId($name)
{
$q = mysql_query("SELECT 'id' FROM 'users' WHERE 'name'=".$name);
while($r = mysql_fetch_assoc($q))
{
return $r['id'];
}
}
?>