This is my code:
include('connectTwo.html');
$query = "select * from users";
$result = mysql_query($query, $connectTwo);
while($row = mysql_fetch_array($result))
{
echo $row['username'];
$user_id = $row['user_id'];
$profile = getProfile($user_id);
echo $profile;
}
function getProfile($user_id)
{
$query = "select * from info where user_id='$user_id'";
$result = mysql_query($query, $connectTwo);
$row = mysql_fetch_assoc($result);
$profile = $row['profile'];
return $profile;
}
The function doesn't return anything. I know that the query is correct because I move it outside the function and it runs and gives me the value I'm looking for. Please post a comment if you are confused about what I'm asking.
$result = mysql_query($query, $connectTwo);What is$connectTwo?include('connectTwo.html');. That file connects to my database and create the$connectTwovariable which I use for the queries. The query variables have the queries inside and then I execute them.$queryis defined in the line before as a string (in both cases) and$connectTwoobviously should be a resource.