开发者

php/mysql (appending html color codes to mysql table values)

This is php specific question. Is it possible to store html color codes in mysql table. So that when there is a php echo, it outputs the values in colors? For all my empty fields, I want to show the background color as red. Can I define a default function in mysql which will append a default colo开发者_StackOverflow中文版r scheme to empty fields? thanks.


Sure, it it possible. You will save it as any other string.. so save "FF00FF" and than you will get this string from your db.
Edit: You don't have to store "#" I suppose - Depends on later use that you are planning.

Edit2: Is this about changing background color of table cell (during rendering) depending on its value? Your Q is unclear to me. But if I understand it correctly, then you can just make simple check like (pseudo):

if (value == null) color = "#FFFFFF";
echo color;

Depending on your rendering logic of course.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜