Jump to content

Echo style sheet or else help!


Deanznet

Recommended Posts

I need to  echo

 

<link rel="stylesheet" type="text/css" href="css/style.css" />

 

But! i need it to check the mysql database if the row pagestyle is empty it will echo

 

<link rel="stylesheet" type="text/css" href="css/style.css" />

 

If not then it will echo

 

<link rel="stylesheet" type="text/css" href="css/style.<? echo $pagestyle; ?>.css" />

 

Link to comment
https://forums.phpfreaks.com/topic/218254-echo-style-sheet-or-else-help/
Share on other sites

<?php
$sql = mysql_query("SELECT pagestyle FROM table WHERE something = something");
$cnt = mysql_num_rows($sql);
if ($cnt != '0') {
   $pagestyle = mysql_result($sql, 0);
?>
<link rel="stylesheet" type="text/css" href="css/style.<? echo $pagestyle; ?>.css" />
<?php
} else {
?>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<?php
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.