Mobile app version of vmapp.org
Login or Join
Lee4591628

: Undefined index: log in C:xampphtdocstutorialshome.php on line 20 18 <?php 19 include("session/DBConnection.php"); 20 $user = $_SESSION['log']['username']; 21 $query = mysql_query("SELECT * FROM members

@Lee4591628

Posted in: #Php

18 <?php
19 include("session/DBConnection.php");
20 $user = $_SESSION['log']['username'];
21 $query = mysql_query("SELECT * FROM members WHERE username = '$user'");
22 $display = mysql_fetch_array($query); ?>
23 <title>sagar- <?php echo $display['firstname'] . " " . $display['lastname'] ?> 23</title>


please help me out...i am so confused...show me ans in code ....what should i have to write....please guys help me..!!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Lee4591628

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sent6035632

You need to check if that array key has been set before using it.

$user = isset($_SESSION['log']) and isset($_SESSION['log']['username'])
? $_SESSION['log']['username']
: '';

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme