根据MYSQL值突出显示列结果 [英] Highlighting column results based on MYSQL value

查看:76
本文介绍了根据MYSQL值突出显示列结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT *

FROM emp

WHERE NOT EXISTS(SELECT emp_old.roll_no,emp_old.name

FROM emp_old

WHERE emp_old.roll_no = emp.roll_no AND

emp_old.name = emp.name)



以上查询工作并选择不匹配roll_no&的列名称,但结果是这2个条件的组合,我需要突出显示哪个roll_no不匹配&哪个名称不匹配..

i尝试如下但如果我插入颜色它显示整列我只需要错误的数据..



while($ row = mysql_fetch_array($ res)){

echo;回声。 $ row ['roll_no']。 ; //哪个rollno错了红色

echo。 $ row ['name']。 ; //蓝色错误的名称

echo; }

SELECT *
FROM emp
WHERE NOT EXISTS (SELECT emp_old.roll_no, emp_old.name
FROM emp_old
WHERE emp_old.roll_no = emp.roll_no AND
emp_old.name = emp.name)

Above query works and selects unmatched columns of roll_no & name but the results is comming combined of this 2 conditions i need to highlight which roll_no is not matched & which name is not matched..
i had tried as follows but if i insert color it shows for whole column i need for wrong data only..

while($row=mysql_fetch_array($res)) {
echo ""; echo "" . $row['roll_no'] . "";// which rollno is wrong in red color
echo "" . $row['name'] . "";//which name is wrong in blue color
echo ""; }

推荐答案

row = mysql_fetch_array(
row=mysql_fetch_array(


res)){

echo; echo。
res)) {
echo ""; echo "" .


row ['roll_no']。 ; //哪个rollno错了红色

echo。
row['roll_no'] . "";// which rollno is wrong in red color
echo "" .


这篇关于根据MYSQL值突出显示列结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆