Help getting image url from data base

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adamhull
    New Member
    • Feb 2014
    • 1

    Help getting image url from data base

    I am struggling to get the img location from my database and execute it to use as a background image using css any ideas here is the code



    Code:
    <?php
    session_start();
    include "includes/db_connect.php";
    include "includes/functions.php";
    logincheck();
    $username=$_SESSION['username'];
    $viewuser=$_GET['viewuser'];
    $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
    $select = mysql_query("SELECT * FROM users WHERE online > '$timenow' ORDER by id");
    $num = mysql_num_rows($select);
    
    $test=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$viewuser'"));
    ?>
    <head>
     <SCRIPT LANGUAGE="javascript">
    
    function click() {
    if (event.button==2) {
    alert('Sorry, this function is disabled.')
    }
    }
    document.onMouseDown=click
    </SCRIPT> 
    <style type="text/css">
    body {
    	
    	background-color: #151515;
    	margin-left: 0px;
    	margin-top: 0px;
    	margin-right: 0px;
    	margin-bottom: 0px;
    	padding: 0;
    SCROLLBAR-FACE-COLOR: #2b0303; SCROLLBAR-HIGHLIGHT-COLOR: #4b0505; SCROLLBAR-SHADOW-COLOR: #140101; SCROLLBAR-3DLIGHT-COLOR: 140101; SCROLLBAR-ARROW-COLOR: #FFFFFF; SCROLLBAR-TRACK-COLOR: #222222; SCROLLBAR-DARKSHADOW-COLOR: #210303;
    }
    body,td,th {
    	font-family: verdana;
    	font-size: 11px;
    	color: black;
    }
    a:link {
    	text-decoration: none;
    	
    
    }
    a:active {
    	text-decoration: none;
    
    }
    a:hover {
    	text-decoration: none;
    
    }
    a:visited {
    	text-decoration: none;
    
    }
    
    
    .gradient {
    	font-family: Arial;
    	font-weight: Bold;
    	font-size: 12px;
    	font-style: normal;
    	line-height: 23px;
    	color: #FFFFFF;
    	background-image: url('<? echo"$test->layout"; ?>');
    	background-repeat: repeat-x;
    	cursor: pointer;
            text-align: center;
    }
    
    a {
    	width: 140px;
    	display: block;
    	padding: 3px;
    	padding-right: 5px;
    	padding-left: 5px;
    	border-top: 1px solid black;
    	background-color: #333333;
    	color: #FFFFFF;
            
    
    }
    a:hover {
    	color: #FFFFFF;
    	background: #CD0000;
    }
    
    </style>
    <!--[if IE]>
    <style type="text/css">
    a {
    	width: 150px;
    	display: block;
    	padding: 3px;
    	padding-right: 5px;
    	padding-left: 5px;
    	border-top: 1px solid black;
    	background-color: #333333;
    	color: #FFFFFF;
            
    
    }
    </style>
    <![endif]-->
    
    
    
    
    <script language="javascript" type="text/javascript">
    function popitup(url) {
    	newwindow=window.open(url,'name','height=520,width=640');
    	if (window.focus) {newwindow.focus()}
    	return false;
    }
    function hide(id){ 
    var hide = document.all? document.all[id + "_block"] : document.getElementById? document.getElementById(id + "_block") : "";
      	if(hide.style.display == 'none'){ hide.style.display = ''; }
      	else{  hide.style.display = 'none'; }
       }
    </script>
    <table width="140" border="0" cellspacing="0" cellpadding="0" bgcolor="#151515">
    <?php if ($fetch->userlevel == "2"){
    echo "<tr>
        <td class=gradient>Staff</td>
      </tr>
    
    
    </tbody>
    </table>


    Image location is set in data base in table users and named layout




    thanks
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    #2
    hi do you have a link to this code running

    Comment

    Working...