Deanznet Posted November 10, 2010 Share Posted November 10, 2010 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" /> Quote Link to comment https://forums.phpfreaks.com/topic/218254-echo-style-sheet-or-else-help/ Share on other sites More sharing options...
radar Posted November 10, 2010 Share Posted November 10, 2010 <?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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/218254-echo-style-sheet-or-else-help/#findComment-1132513 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.