Answer the question
In order to leave comments, you need to log in
How to fix Notice: Undefined index: uid in?
Error when calling uinfo function Error
itself:
Notice
: Undefined index: uid in ....
Function itself:if(uinfo($_SESSION['uid'],"who") == 2) {
function uinfo($uid,$value) {
global $con;
$sql = $con->prepare("SELECT * FROM users WHERE username =?");
$sql->execute(array($uid));
$row = $sql->fetch(PDO::FETCH_ASSOC);
return $row[$value];
}
Answer the question
In order to leave comments, you need to log in
php.net/manual/ru/function.empty.php
php.net/manual/ru/function.isset.php
php.net/manual/ru/function.array-key-exists.php
for example, in the function check
if(!is_null($uid)) {
.. database query
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question