I have the following table set in my mysql database
mem_id | pid | content
0 | 1 | All the content is here
0 | 2 | All the content is here
0 | 3 | All the content is here
Now the problem is to get all matching mem_id
values and store it in a array in php.
Example: A variable called $id
has value 0
So now I have to get all values under the column content but only those which matches the mem_id
of the user.
Could anyone help me with this, I need it in php and using mysql query to get all the values.
My current code:
$con=mysqli_connect("localhost","*****","******","*****");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM user_friends WHERE mem_id = '$_SESSION[SESS_MEMBER_ID]' LIMIT 1");
while($row = mysqli_fetch_array($result))
{
$friends = $row['fid'];
}