I have a mysql database with a string field called "color" from java I keep the value so:
// (2=color field)
pst.setString (2, objeto.getBackground (). getRGB ())
and then I read it like this:
objeto.setBackground (Color.decode (rs.getString ("color")))
Is there any function in mysql or php to read the color?
What do you want exactly?
Convert a int to a color in #RRGGBB format?
sprintf('#%06X', $color);
or get the R, G, B values?
$r = ($color >> 16) & 0xFF;
$g = ($color >> 8) & 0xFF;
$b = ($color >> 0) & 0xFF;
or create a int from rgb values
$color = ($r & 0xFF) << 16 | ($g & 0xFF) << 8 | $b & 0xFF