indexia Posted June 21, 2012 Share Posted June 21, 2012 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 </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; ?> Quote Link to comment Share on other sites More sharing options...
Ivan Ivković Posted June 21, 2012 Share Posted June 21, 2012 "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. Quote Link to comment Share on other sites More sharing options...
indexia Posted June 21, 2012 Author Share Posted June 21, 2012 Hi i want a search form to search in my database and output it in the current table Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted June 21, 2012 Share Posted June 21, 2012 Are you looking for something like this: http://phpsnips.com/snip-94 Quote Link to comment Share on other sites More sharing options...
indexia Posted June 21, 2012 Author Share Posted June 21, 2012 yes something like that any ideas with integrations? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.