I have written the code below, which should check the session variable against the database and give me the username which = user id which is in the session.
If I echo $session_name;
I get a user id e.g. 30
If I echo $row2;
I get Array
What am I doing wrong?
<?php
connect();
$session_name = $_SESSION[id];
$sql2 = "SELECT username FROM members WHERE member_id = '$session_name'";
$result2=mysql_query($sql2);
$row2 = mysql_fetch_array($result2);
echo $row2;
?>