Re: change the font color of a string variable in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi chris,
 
i am using mssql and php, so i trying to get the query result when the user enters the query and submits the execute button.

i want to differentiate the syntactically correct query and the incorrect query with differ colors.

here i am posting my code
if (-1 == $connection) 
                 $result = mssql_query($query);// or die("Fehler beim Schreiben in die Datenbank");
               else
                 $result = mssql_query($query, $connection);// or die("Fehler beim Schreiben in die Datenbank");
               
                          if (!$result) {
          print "<p style=\"color:red;\">MS-SQL-Fehler: ".mssql_get_last_message()."</p>\n";
          $error=1;  //my changes}

what i am trying to do is intialising a global variable "$error=0" and changing it to 1 if error occurs.

when displaying i am writing like this

foreach($_SESSION['history'] as $item) {
                 $item = str_replace(";","",$item);
                 if(error==0)
                 echo "<option >$item</option>";
                 else
                 echo "<option style=\"color: red;\">$item</option>";

but it doe not work can you pls tell me.


Chris Ramsay <raz.net@xxxxxxxxx> wrote:Babu,

Check out:
http://www.trans4mind.com/personal_development/StyleSheets/formElements.htm
or google
http://www.google.com/search?hl=en&q=option+text+colour&meta=

HTH

Chris


Send instant messages to your online friends http://uk.messenger.yahoo.com 

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux