Php 基于从数据库获取的值的行高亮显示
下面我展示了显示表格行的PHP代码,如果selected_val在selected_候选表格中为1,我如何突出显示行 下面我展示了我正在使用的查询和if/else循环。我收到以下警告:“警告:mysql\u fetch\u array:提供的参数不是有效的mysql结果资源”Php 基于从数据库获取的值的行高亮显示,php,mysql,Php,Mysql,下面我展示了显示表格行的PHP代码,如果selected_val在selected_候选表格中为1,我如何突出显示行 下面我展示了我正在使用的查询和if/else循环。我收到以下警告:“警告:mysql\u fetch\u array:提供的参数不是有效的mysql结果资源” <?php if(isset($_POST['Submit'])) { $i=0; while($data_set = mysql_fetch_array($resu
<?php
if(isset($_POST['Submit']))
{
$i=0;
while($data_set = mysql_fetch_array($result_set))
{
$i=0;
echo "<div id=\"Message1[$i]\" class=\"box\">";
echo "Country ={$data_set['ecountry']}<br/>";
echo "State = {$data_set['estate']}<br/>";
echo "</div>";
echo "<tr>";
echo "<td><input id=\"select_candi{$i}\" onclick=\"javascript:func(this.id,{$_SESSION['uid']})\" type=\"checkbox\" name=\"check_candi[]\" value=\"{$data_set['eid']}\"/></td>";
echo "<td>{$data_set['ename']}</td>";
echo "<td>{$data_set['lname']}</td>";
echo "<td>{$data_set['ecell']}</td>";
echo "<td>{$data_set['eposition']}</td>";
echo "<td>{$data_set['eemail']}</td>";
if($data_set['ecity']=='')
{
echo "<td>{$data_set['ecountry']}</td>";
}
else
{
echo "<td onmouseover=\"ShowText('Message1[$i]'); return true;\" onmouseout=\"HideText('Message1[$i]'); return true;\" href=\"javascript:ShowText('Message1')\">{$data_set['ecity']}</td>";
}
// echo "<td>{$data_set['ecountry']},{$data_set['estate']},{$data_set['ecity']}</td>";
echo "<td>{$qua}</td>";
echo "<td>{$data_set['other_work1']} {$data_set['other_work2']}{$data_set['other_work3']}{$data_set['other_work4']} {$data_set['other_work5']} {$data_set['other_work6']} {$data_set['other_work7']} {$data_set['other_work8']} {$data_set['other_work9']} {$data_set['other_work10']}
{$data_set['other_work1e']} {$data_set['other_work2e']} {$data_set['other_work3e']} {$data_set['other_work4e']} {$data_set['other_work5e']} {$data_set['other_work6e']} {$data_set['other_work7e']} {$data_set['other_work8e']} {$data_set['other_work9e']} {$data_set['other_work10e']}
</td>";
echo "<td><a href=\"detailcv.php?id={$data_set['eid']}\" target=\"_blank\"><input style=\" cursor:hand;width:40px\" class=\"button\" name=\"cv\" type=\"button\" value=\"C V\" /></a></td>";
echo "</tr>";
$i++;
}
}
?>
如果循环:
if($data_set['selected_val']=='1')
{
echo "<script>$('#{$rowid}').css(\"background-color\",\"yellow\");</script>";
}
$rowid++;
selected_candidate Table
eid int(30)
rid int(30)
selected_val int(1)
employee表还包含eid int30
谢谢。此错误通常表示您的查询有错误。要获得更多详细信息,请将mysql\u query$query替换为mysql\u query$queryor dieysql\u error
可能是语法错误或列名键入错误。您需要为我们提供更多有关此问题的上下文。从你收到的错误来看,可能有很多事情出了问题。可能您没有在PHP中选择数据库。最初我是正确获取值的,但当我在查询中添加第二个表selected\u candidate时,它给了我这个结果您能显示MySQL表的结构吗?我有这个$result\u set=MySQL\u query$query,通过简单地用mysql\u query$queryor dieysql\u error替换mysql\u query$query来编写mysql\u query$queryor dieysql\u error。即,$result\u set=mysql\u query$queryor diemsql\u error;这表明此行有一些错误,请检查语法$query.=来自员工emp,所选候选人sc;这是因为您试图同时从两个表中进行选择。您应该使用from从主表中进行选择,然后在适当的情况下使用inner join和left join连接其他表。v是否可以继续聊天?
if($data_set['selected_val']=='1')
{
echo "<script>$('#{$rowid}').css(\"background-color\",\"yellow\");</script>";
}
$rowid++;
selected_candidate Table
eid int(30)
rid int(30)
selected_val int(1)