how to change website background using php and mysql? -


i have issue changeing background , show or change background if image id =1 , how can dysplay other values ?

here php code :

<?php include "config.php"; //database connection file //check database background color $check_page_color = mysql_query("select * `page_color` `id` = '".mysql_real_escape_string('1')."'"); // `id` = '".mysql_real_escape_string('1')."' if(mysql_num_rows($check_page_color) > 1) //if no color found, use default color below > 1 { $page_color = "#f9f9f9"; //default color } else {     $get_page_color = mysql_fetch_array($check_page_color);     $page_color = strip_tags($get_page_color["background_color"]); //color database } ?> 

css :

<style type="text/css">  body {   background-image: url(<?php echo $page_color; ?>); </style> 

and here html code displays photos :

new background:<select name="img" class="vpb_field" id="color" style="height: 40px; width: 151px" >                 <option><?php echo $page_color; ?></option>             </select> <span class="vpb_general_button" onclick="vpb_submit_form();">submit</span> 

why taking 1 id in mysql can take while , add them in string[] , again can make new while on option color options

<?php $page_color = mysql_query("select * `page_color`");    $counter = 0;   $i = 0;   while($showall = mysql_fetch_array($page_color))         {         extract($showall);//<-- cut data hire         $counter++;         $array_colors[] = $color; // <-- mysql col         ?>         <select name="img" class="vpb_field" id="color" style="height: 40px; width: 151px" >        <?php while($i < $counter) // <-- can change if u want size_of               {echo '<option>'. $array_colors[$i] .'</option>';}          ?>         </select> 

this give options ucan use other html code


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -