Search Results

Search found 1 results on 1 pages for 'user2966551'.

Page 1/1 | 1 

  • Array to string conversion in (cant get it to work)

    - by user2966551
    ok I am trying to pull a a specific row of data that corresponds to the username logged in. on my page I have started my session but for some reason I cant get the code to work.i keep getting a "Array to string conversion in " on the line " WHERE username = '$_SESSION[user]'");" what am I doing wrong? if I set username = a set username it works but I need it to draw from the session id so it will display different values based on whos logged in. <?php $con=mysqli_connect("localhost","root","xxx","xxxx"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM users WHERE username = '$_SESSION[user]'"); while($row = mysqli_fetch_array($result)) { echo $row['username'] . " " . $row['att']; echo "<br>"; } ?>

    Read the article

1