Long time that i dont program php.
i made a function for the cliente profile,so the cliente can see his logo
this is the cliente code
function display_logo(){
global $conn;
$stmt = $conn->prepare("SELECT LogoImage FROM usuarios WHERE email=?");
$stmt->bind_param("s", $em);
$em = $_SESSION['useremail'];
$stmt->execute();
$result = $stmt->get_result();
$rows = $result->fetch_assoc();
$img =$rows['LogoImage'];
echo '<img style=" margin-top: -14;
object-fit: contain;" src="includes/file?file=' . $img. '" />';
}
This code works fine for the cliente profile. But now i am trying to display all users in my admin painel.
This way ...
function display_all_logo(){
global $conn;
$stmt = $conn->prepare("SELECT * LogoImage FROM usuarios");
// $stmt = $conn->prepare("SELECT LogoImage FROM usuarios WHERE nome=?");
// $stmt->bind_param("s", $em);
// $em = $_SESSION['userName'];
$stmt->execute();
$stmt->bind_result($LogoImage);
while($stmt->fetch()) {
$tmp = array();
$tmp["LogoImage"] = $LogoImage;
array_push($LogoImage, $tmp);
}
$img =$rows['LogoImage'];
echo '<img style=" margin-top: -14;
object-fit: contain;" src="includes/file?file=' . $img. '" />';
}
i know that i'm doing something wrong, please someone help, long time that i don't program php.
Fixed
function display_all_logo($user_logo){
global $conn;
$stmt = $conn->prepare("SELECT LogoImage FROM usuarios WHERE logoImage = ? ");
$stmt->bind_param("s", $em);
$em = $user_logo;
$stmt->execute();
$result = $stmt->get_result();
$rows = $result->fetch_assoc();
$img =$rows['LogoImage'];
return '<img style=" margin-top: -14;
object-fit: contain;" src="includes/file?file=' . $img. '" />';
}