Zoek Functie, Tabel weergave

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Robin B

Robin B

12/04/2013 10:57:17
Quote Anchor link
Hallo,

Ik ben bezig met een zoekfunctie die in verschillende tabellen zoekt. Deze zoekfunctie werkt nu maar hij laat als resultaat beide tabellen zien in het form
Afbeelding
Afbeelding
Dit is de code van mijn zoekfunctie:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
                                                <p><br>
                                                    <b><label for="sf">Bedrijfsnaam</</label></b>
                                                    <input class="sf" name="rel_1" type="text" value="" />
                                                </p>
                                                <p><br>
                                                    <b><label for="sf">Contactpersoon</label></b>
                                                    <input class="sf" name="rel_2" type="text" value="" />


En in het FORM als voorbeeld 2 tabellen
//// table 1
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
                                    <table class="tablesorter normal" cellspacing="0" cellpadding="0" border="0">
                                        <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>Relatie</th>
                                                <th>Address</th>
                                                <th>Postcode</th>
                                                <th>Woonplaats</th>
                                                <th>Telefoon</th>
                                            </tr>
                                        </thead>
                                        <tbody>                                         
                                            <?php
                                            if(isset($_POST['submit'])){

                                                while($data_fetch=mysql_fetch_array($query_for_result_cus))
                                                {

                                            echo "<tr>";
                                                echo "<td>";
                                                echo $data_fetch['Cus_ID'];
                                                echo "</td>";
                                                echo "<td>";
                                                echo substr($data_fetch[$db_tb_atr_cus_name], 0,30);
                                                echo "</td>";
                                                echo "<td>";
                                                echo $data_fetch['Cus_aa'];
                                                echo "</td>";
                                                echo "<td>";                                            
                                                echo $data_fetch['Cus_ss'];
                                                echo "</td>";
                                                echo "<td>";                                            
                                                echo $data_fetch['Cus_dd'];
                                                echo "</td>";
                                                echo "<td>";                                            
                                                echo $data_fetch['Cus_ee'];
                                                echo "</td>";                                        
                                            echo "</tr>";
                                                }
                                                                        }

                                            else {
                                                echo "U heeft geen gegevens ingevoerd";
                                            }

                                            ?>

                                        </tbody>
                                    </table>

<br></br>

//// table 2
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
                                    <table class="tablesorter normal" cellspacing="0" cellpadding="0" border="0">
                                        <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>Voornaam</th>
                                                <th>Tsv</th>
                                                <th>Achternaam</th>
                                                <th>Functie</th>
                                                <th>Telefoon</th>
                                            </tr>
                                        </thead>
                                    <tbody>                                         
                                        <?php
                                        if(isset($_POST['submit'])){

                                            while($data_fetch=mysql_fetch_array($query_for_result_con))
                                            {

                                        echo "<tr>";
                                            echo "<td>";
                                            echo $data_fetch['Con_ID'];
                                            echo "</td>";
                                            echo "<td>";
                                            echo substr($data_fetch[$db_tb_atr_con_name], 0,30);
                                            echo "</td>";
                                            echo "<td>";
                                            echo $data_fetch['Con_aa'];
                                            echo "</td>";
                                            echo "<td>";                                            
                                            echo $data_fetch['Con_bb'];
                                            echo "</td>";
                                            echo "<td>";                                            
                                            echo $data_fetch['Con_cc'];
                                            echo "</td>";
                                            echo "<td>";                                            
                                            echo $data_fetch['Con_dd'];
                                            echo "</td>";                                        
                                        echo "</tr>";
                                            }
                                                                    }

                                        else {
                                            echo "U heeft geen gegevens ingevoerd";
                                        }

                                        ?>

                                    </tbody>
                                    </table>


REL_1 is Bedrijfsnaam en REL_2 contactpersoon hoe laat ik alleen de tabel zien van hetgene dat op gezocht wordt. Misschien op basis van $query_for_result_cus en $query_for_result_con ?


Groeten Robin
Gewijzigd op 12/04/2013 11:10:03 door Robin B
 
PHP hulp

PHP hulp

14/11/2024 19:12:26
 
- Ariën  -
Beheerder

- Ariën -

12/04/2013 11:03:50
Quote Anchor link
Zou je je code graag even tussen [code] en [/code] kunnen plaatsen door je bericht te bewerken? Dat maakt de het script even wat beter leesbaarder.
Alvast bedankt...
 
Robin B

Robin B

12/04/2013 11:09:12
Quote Anchor link
Ja, gedaan, wellicht dat is iets met IF's moet doen om de juiste tabel te laten zien ?
Gewijzigd op 12/04/2013 11:10:49 door Robin B
 
Robin B

Robin B

15/04/2013 09:12:34
Quote Anchor link
niemand ?
 
Erwin H

Erwin H

15/04/2013 10:46:18
Quote Anchor link
Als je het nu gewoon eens helder opschrijft en dan vertaald (naar het Engels), dan heb je je antwoord al.
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.