Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7645285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:54:08+00:00 2026-05-31T09:54:08+00:00

Here is my problem, I have a site I am building. I am including

  • 0

Here is my problem, I have a site I am building. I am including an admin page to manage everything on the fly, that i have no issue with as it is pretty straight forward php, mysql etc. I have it in my head that i can use a database to store css and dynamically call it up as i add new setting for the different classes, id’s etc. my table is this:
settings
id–class–div–setting

Where class is something like body, header, footer, etc. and div and setting are as follows:

.header {
$div:$setting;
}

in my script i am echoing the style tag and including this inside of the head tags.

my code for what it is worth is below:

$header_query = mysql_query("SELECT style, setting FROM styles WHERE class='header'");
$header_result = mysql_fetch_array($header_query);


echo "<style type='text/css'>";
echo ".header {";
   foreach($header_result as $hstyle => $hsetting){
   echo $hstyle.":".$hssetting.";";
   }

   echo "}";
   echo "</style>";

I figgured that would be enough to echo each setting for that particular class and I was right in part. Instead of echoing out the desired code my echo(depending on the mysql_fetch command i use) spits out something like this:

<style>
.header {
0:div;1:background;2:setting;3:url(x.jpg)
}
</style>

Any ideas, I’m stumped?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:54:10+00:00Added an answer on May 31, 2026 at 9:54 am

    mysql_fetch_array fetches one row. So you may use something like

    $header_query = mysql_query("SELECT style, setting FROM styles WHERE class='header'");
    
    echo "<style type='text/css'>";
    echo ".header {";
    
    while($header_result_row = mysql_fetch_array($header_query,MYSQL_ASSOC))
        echo $header_result_row['style'].":".$header_result_row['setting'].";";
    
    echo "}";
    echo "</style>";
    

    Almost all mysql_fetch_* are only affecting a single row, keep that in mind. See also the mysql_fetch_array examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my problem...I have a page that loads a list of clients and
hey everyone, here is the site SEE BELOW I have a slight jquery problem
Here's my problem: I have a virtual method defined in a .h file that
I'm building a responsive site, and on one particular page, I'm trying to have
I have problem adding arraylist to list view, will explain about my problem here..
First, sorry for my bad english, I'm French. Here the problem : I have
Here is the problem I have: I have a lot (tens of thousands) of
Here's my problem - I have some code like this: <mx:Canvas width=300 height=300> <mx:Button
Here is the problem: we have lots of Javascripts and lots of CSS files,
Here's my problem: I have to call a web service with a secure header

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.