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
4 Respuestas
+ 1
try to var_dump your $row and see if index u_name is exist
+ 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
+ 1
thanks bro
it worked i found my error
and i fix it
it was really helpfull
keep up a good work
thank you
0
return NULL what should i do