Felix:

Depending on what you're trying to do try either of these:

//Check to see if $color is in DB:

$connection = mysql_connect("localhost","user","pass") or die("Died at 
connection.");
$sql = "SELECT * FROM user_prefs WHERE u_id='$UserID'";
$result = mysql_db_query($sql, $connection) or die("Died at query.");
$color = mysql_num_rows($result);

//If query didn't die, check to see if there is a result for this query:
if($color != 0) {
echo "<table bgcolor=\".$color['color_1'].\" class=\"nav\">";
}
else{
echo "Some error message.";
}

//Print $color to page:

$connection = mysql_connect("localhost","user","pass") or die("Died at 
connection.");
$sql = "SELECT * FROM user_prefs WHERE u_id='$UserID'";
$result = mysql_db_query($sql, $connection) or die("Died at query.");
while($row = mysql_fetch_array($result)) {
        $color = $row['color_1'];
        echo "<table bgcolor=\"$color\" class=\"nav\">";
        }

Try that little pup on for size...

Russ


#-------------------------------------------------------#
                                
         "Believe nothing - consider everything"        
                                                        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com
                        
#-------------------------------------------------------#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to