0

Db

$sql = "SELECT * FROM table"; $result = mysqli_query($conn, $sql); $row = mysqli_fetch_assoc($result); $_SESSION['u_name'] = $row['u_name']; In Another page Echo $_SESSION['u_name']; The session is started I include the database. And i get error Undefined index u_name in c:\bla bla Please help What is wrong with this code? Please

25th Apr 2019, 7:26 AM
Eyob
Eyob - avatar
4 Réponses
+ 1
try to var_dump your $row and see if index u_name is exist
25th Apr 2019, 7:31 AM
Taste
Taste - avatar
+ 1
trace it where the null come from ? the $result then check it, what if the $result is also wrong ? that means the mysqli_query, then check your query is something wrong with them. you can also look at mysqli_error() to see if there are any error when mysql executing your query
25th Apr 2019, 7:56 AM
Taste
Taste - avatar
+ 1
thanks bro it worked i found my error and i fix it it was really helpfull keep up a good work thank you
25th Apr 2019, 8:08 AM
Eyob
Eyob - avatar
0
return NULL what should i do
25th Apr 2019, 7:52 AM
Eyob
Eyob - avatar