Jump to content

Searching in html table


indexia

Recommended Posts

How can i implement a search engine in this kind of html table?

 

<?php 
$s=$_GET["s"];

mysql_select_db("cazier");
$sql="select * from contacts";

$contactsArray = array();
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
$contactsArray[] = $row;
}


  foreach($contactsArray as &$contact){
$contact['notes']=array();

$result2 = mysql_query("select notes.note_text AS 'note_text', users.user_nume AS 'user_nume', users.user_email AS 'user_email', users.user_telefon AS 'user_telefon', users.user_firma AS 'user_firma' from notes, users where notes.note_contact='".$contact['contact_id']."' AND users.user_id=notes.note_user");

while ($row2 = mysql_fetch_assoc($result2)){
$contact['notes'][] = $row2; 
} 
mysql_free_result($result2);
}


$test="<a href=''>Adauga detalii sofer</a>";

$tableHtml = "<table border ='1' bgcolor='#ffffdd' id='tester' width='900' border='0' cellspacing='0' cellpadding='0'><tr>
<th  align=\"center\" colspan='3'>Nume sofer</th>
<th align=\"center\" colspan='3'>CNP&nbsp</th>
<th align=\"center\" colspan='3'>Telefon sofer</th>
<th align=\"center\" colspan='3'>Detalii sofer</th>
</tr>";

for ($i=0;$i<count($contactsArray);$i++)	{

$tableHtml .= "<tr>
<td width=\"10%\" align=\"center\" colspan='3'>".$contactsArray[$i]['contact_first']." ".$contactsArray[$i]['contact_last']."  </td>
<td width=\"10%\" align=\"center\" colspan='3'>".$contactsArray[$i]['contact_title']."  </td>
<td width=\"10%\" align=\"center\" colspan='3'>".$contactsArray[$i]['contact_phone']."  </td>
<td width=\"70%\" colspan='3'>  ";

$notesString = "<ul><table border='1' width='550' ><tr>";
foreach ($contactsArray[$i]['notes'] as $note){
$notesString .= "<tr><td BGCOLOR=\"#DDDDDD\"><center>".$note['user_firma']."</center>"; 
$notesString .= "<center>".$note['user_nume']."</center>"; 
$notesString .= "<center>".$note['user_email']."</center>"; 
$notesString .= "<center>".$note['user_telefon']."</center>"; 
$notesString .= "<center><font color='#0404B4'> Note si comentarii : </font></center>";
$notesString .= "<center>".$note['note_text']."</center></td></tr>"; 
}
$notesString .= "</tr></table></ul>";

$tableHtml .= $notesString ;
$tableHtml .= "<center><a href='#' data-usrid='".$contactsArray[$i]['contact_id']."' class='modal'>Adauga detalii</a> </center></td></tr>";


}

$tableHtml .= "</table>" ;
echo $tableHtml;




?>

Link to comment
Share on other sites

"Implement a search engine in this kind of table".

 

What exactly do you want?

 

A search engine does not search the HTML table.

 

A search engine is not implement in your table.

 

A search FORM can be implemented in your table, and it depends what you want your search engine (the backend code) search from the DATABASE and where to output it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.