Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
202 views
in Technique[技术] by (71.8m points)

How can I add a search box in my table (php, mysql)

I been working in a quiz, it stores the data of the users who register and has a section that displays the scores obtained grabbing them from my database in mysql, here is the structure:

echo  '<div class="panel"><table class="table table-striped title1">
<tr><td><b>S.N.</b></td><td><b>User</b></td><td><b>Lastname</b></td><td><b>Name</b></td><td><b>Carrer</b></td><td><b>Correct Answers</b></td><td><b>Incorrect answers</b></td><td><b>Persentage</td>';
$c=1;
while($row = mysqli_fetch_array($result)) {
    $qid = $row['qid'];
  $ansid = $row['ansid'];
  $incorrectos = 60-$ansid;
  $porcentaje = round(($ansid/60)*100,2);
  $lastname = $row['lastname'];
  $name = $row['name'];
  $career = $row['career'];
 $email = $row['email'];
$rowcount=mysqli_num_rows($result); 
if($rowcount == 0 && $email != $qid){
  echo '<tr><td>'.$c++.'</td><td><p id="qid">'.$qid.'</p></td><td>No info to display</td><td>No info to display</td><td>'.$ansid.'</td><td>'.$incorrect.'</td><td>'.$percentage.'</td></tr>';
}
else
{
echo '<tr style="color:#99cc32"><td>'.$c++.'</span></td><td><p name="qid">'.$qid.'</p></td><td>'.$lastname.'</td><td>'.$name.'</td><td>'.$career.'</td><td>'.$ansid.'</td><td>'.$incorrect.'</td><td>'.$percentage.'</td></tr>';
}
}
$c=0;
echo '</table></div>';
}

Im looking how to implement a search bar that looks for the given word and display the matching records, is there any example to implement this tool?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.7k users

...