richarro1234 Posted January 21, 2010 Share Posted January 21, 2010 Hello, Im trying to change some info that has been output from the database, basically its an interview, and i would like to change the color of the names being output from the database using define. <? session_start(); include("dbconfig.php"); ?> <? $query = mysql_query("SELECT * from interviews WHERE bid = '".$_GET['id']."'"); while ($b = mysql_fetch_array($query)) { $intid = $b['id']; $interview = $b['interview']; $bandid = $b['bid']; $location = $b['location']; $date = $b['date']; } define("E.G.G","<font color=\"ff0000\">E.G.G</font>"); ?> <? include ("header.php"); ?> <div id="mainCont"> <div id="leftCol"> <div id="bandinfo"> <h3>Location: <?=$location?></h3> <p><? echo $interview; ?></p> </div> </div> <div id="centrCol"> <div id="albmBlock"> But this doesnt change the color of "E.G.G". Is there away to do this without having to go into phpmyadmin and adding the <font> tage to every name in there as it is quite a long peice of text? Thanks Rich Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 21, 2010 Share Posted January 21, 2010 1. define defines a constant, and constant can't have a . in it's name... 2. I can't see you use this constant anywhere 3. Perhaps you're looking for str_replace? Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 21, 2010 Share Posted January 21, 2010 As what he said above, define is for constants. A constant means that it is a variable that is meant to be present throughout the life of the entire website and/or application. Whereas a variable is normally temporary, a constant is meant to contain data or pieces of data and information that will need to be reused various time within the life cycle of an application. Quote Link to comment Share on other sites More sharing options...
richarro1234 Posted January 21, 2010 Author Share Posted January 21, 2010 @mchl: 1,2, i had a constant but it just came up with "could not find constant", and now i know why. 3 i thought could only be used when inserting data into a databse, but will give it a go and see what happens @businessman: thanks for clearing that up. Thanks for your help guys Rich Quote Link to comment 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.