我試圖顯示從php代碼中獲取的圖像。下面是我的代碼n =但它沒有顯示任何內容。有人請幫忙。是否有可能在PHP中包含css
<?php
$db_conx=mysqli_connect("localhost","root","sultan","slide");
$sql = "SELECT * FROM photo WHERE username='shail' LIMIT 1";
$user_query = mysqli_query($db_conx, $sql);
// Fetch the user row from the query above
while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) {
$profile_id = $row["id"];
$avatar1 = $row["avatar1"];
}
$profile_pic1 = '<img src="user/shail/'.$avatar1.'" width="100" height="80" >';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
#small{ background-image:<?php echo $profile_pic1 ?>;}
</style>
</head>
<body>
<div id="small"></div>
</body>
</html>
感謝 Shail
它不應該是這樣:':URL' – Ghost