Jump to content

php to change background image


conan318

Recommended Posts

Hi i am trying to write a small script to change the background img from my admin small panel i am making im not getting errors nor is the background img  for my content changing. if i echo $background it display the img url correctly. can anyone see what where its going wrong

 

thanks again


$background;
$data = mysql_query("SELECT * from main.background  ORDER BY id DESC LIMIT 1;") or die(mysql_error());
//Puts it into an array 

while($info = mysql_fetch_array( $data )) 
{ 





$background='img/'.$info['img']; // have also tryed  $background="img/".$info['img'];


}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<LINK REL="SHORTCUT ICON" HREF="img/fav.png">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mb.css" rel="stylesheet" type="text/css" />
<title>Mongrel Bastards</title>


</head>

<body>
<style type="text/css">
.content{

    background-image:url('<?php $background ?>');
height:2500px; width:1008;}



</style>

Link to comment
Share on other sites

is the style element meant to be in  the head of the document cause i have tryed it there with no luck either.

if i  add the image in css file it works fine. but for some reason i cant embed it. strange

did you try to echo  as showed above??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.