MuhammadJavadi
MuhammadJavadi

Reputation: 33

Change Style Sheet with php variable that connecting to mysql

Well I want stylesheet URLs to be stored in the database, and change the stylesheets href by variables in html tags.

But nothing happen when i using this code:

 global $theme_addresss;
    global $showdetail_dbtadbirusers;
    require 'displaycustomersdb.php'; /*this file store usercode in variable via session*/
    $sql_changetheme = mysqli_query($link, "SELECT profile_theme FROM tusers WHERE usercodecode='{$usercodecode}'");
    $sql_result_changetheme = mysqli_fetch_array($sql_changetheme);
   $theme_addresss = $sql_result_changetheme['profile_theme'];

<link rel="stylesheet" href='<?php  echo $theme_addresss; ?>'>

Upvotes: 0

Views: 150

Answers (2)

MuhammadJavadi
MuhammadJavadi

Reputation: 33

I find out what is the problem, the code is fine. i just put <link rel="stylesheet" href="<?php echo $theme_addresss; ?>"> into the other page of my website and it worked!

Upvotes: 1

Sakti Behera
Sakti Behera

Reputation: 76

Can you try change single quote to double quote around href and see if it works?

<link rel="stylesheet" href=“<?php echo $theme_addresss; ?>”>

Upvotes: 0

Related Questions