Announcement

Collapse
No announcement yet.

some help with search form in blank aplication

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • some help with search form in blank aplication

    I will apreciate if somebody can help me, I need to design a search form (with code) in blank aplication with results in same blank aplication, thanks in advance

  • #2
    what do you need to search for?... is it somehting in a single table?. Why does it need to be in a blank application?

    Comment


    • #3
      Thank you kafecadm I solved!

      Comment


      • #4
        Dear Kafecadm, I have another problem if you can help, I have this code in a blank app:
        --------------------------------------------------------------------------------------------------------------------------------
        $sql = "SELECT DISTINCT ciudad, direccion from propiedades ";
        sc_lookup(dataset1,$sql);


        ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        </head>
        <body>
        <table border = "1">
        <thead>
        <th>Ciudad</th>
        <th>Direccion</th>
        </thead>

        <tbody>
        <?php foreach({dataset1} as $aCategory1){?>
        <tr>
        <td><?php echo $aCategory1[0]; ?></td>
        <td><?php echo $aCategory1[1]; ?></td>
        </tr>
        <?php } ?>
        </tbody>

        </table>

        </body>
        </html>
        <?php
        -------------------------------------------------------------------------------------------------------------------------
        This is the results :
        City Adress
        Santiago Bilbao 8978
        Santiago Las Condes 7458
        Santiago Santa Rosa 56210
        How can I do to get this results
        City Adress
        Bilbao 8978
        Santiago Las Condes 7458
        Santa Rosa 56210

        Comment


        • #5
          make 2 queries:

          PHP Code:

          $query_cities 
          "SELECT DISTINCT ciudad FROM propiedades";

          sc_lookupcities $query_cities );

          foreach( {
          cities} as $City)
          {
             
          $query_addresses "SELECT DISTINCT dirección FROM propiedades WHERE ciudad = " $City;
             
            
          sc_lookupaddresses$query_addresses);
            
             
          $rowspan count({addresses}); // count the number of addresses by city
            
             
              
          echo ' <tr><td rowspan = "$rowspan">"$City" <td>"{addresses[0][0]}" </td></tr>';
             for ( 
          $x=; $< $rowspan $x++)
              {
                 echo 
          '<tr><td></td><td>"{addresses[0][$x]}"</td></tr>';

              }
             



          hope this helps even if it has some errors...

          regards

          Comment


          • #6
            Thank you very much, but it has errors, and I can't detect them

            This is the error: Parse error: syntax error, unexpected '<', expecting variable (T_VARIABLE) or '$' in C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase\app\viewhouse\ tabla_agrupaciones\index.php on line 1116

            Comment


            • #7
              oh man well it was kinda late and i was on my mobile so no surprise there.

              PHP Code:
              $query_cities "SELECT DISTINCT ciudad FROM propiedades";

              sc_lookupcities $query_cities );

              foreach( {
              cities} as $City)
              {
                 
              $query_addresses "SELECT DISTINCT dirección FROM propiedades WHERE ciudad = " $City;
                 
                
              sc_lookupaddresses$query_addresses);
                
                 
              $rowspan count({addresses}); // count the number of addresses by city
                
                 
                  
              echo ' <tr><td rowspan ="' $rowspan .'">' $City '<td>' . {addresses[0][0]} .  '</td></tr>';
                 for ( 
              $x=; $< $rowspan $x++)
                  {
                     echo 
              '<tr><td></td><td>' . {addresses[0][$x]} . '</td></tr>';

                  }
                 



              There?.

              Regards

              Comment


              • #8
                No yet, There is a little error but i don' know which is it,

                Regards

                Comment


                • #9
                  replace {addresses[0][$x]}

                  use

                  {addresses[$x][0]}

                  instead.

                  Comment


                  • #10
                    Hello Kafecadm, Thank you very much for your, however it doesn't work yet, I can't find the error

                    Comment


                    • #11
                      need a lil bit more information, could you please show me the error you're receiving?.

                      Regards

                      Comment


                      • #12
                        Ok,

                        Last PHP code you gave me:


                        $query_cities = "SELECT DISTINCT ciudad FROM propiedades";

                        sc_lookup( cities , $query_cities );

                        foreach( {cities} as $City)
                        {
                        $query_addresses = "SELECT DISTINCT direccion FROM propiedades WHERE ciudad = " . $City;

                        sc_lookup( addresses, $query_addresses);

                        $rowspan = count({addresses}); // count the number of addresses by city


                        echo ' &lt;tr&gt;&lt;td rowspan ="' . $rowspan .'"&gt;' . $City . '&lt;td&gt;' . {addresses[0][0]} . '&lt;/td&gt;&lt;/tr&gt;';
                        for ( $x=1 ; $x &lt; $rowspan ; $x++)
                        {
                        echo '&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;' . {addresses[$x][0]} . '&lt;/td&gt;&lt;/tr&gt;';

                        }


                        }

                        ______________________________________________

                        THE ERROR:
                        Error
                        Array to string conversion
                        Error
                        Array to string conversion
                        Array

                        ---------------------------------------------------------------------------

                        regards

                        ​Bdo

                        Comment


                        • #13
                          Last code you gave me:

                          PHP Code:
                          $query_cities "SELECT DISTINCT ciudad FROM propiedades";

                          sc_lookupcities $query_cities );

                          foreach( {
                          cities} as $City)
                          {
                             
                          $query_addresses "SELECT DISTINCT direccion FROM propiedades WHERE ciudad = " $City;
                             
                            
                          sc_lookupaddresses$query_addresses);
                            
                             
                          $rowspan count({addresses}); // count the number of addresses by city
                            
                            
                              
                          echo ' <tr><td rowspan ="' $rowspan .'">' $City '<td>' . {addresses[0][0]} .  '</td></tr>';
                             for ( 
                          $x=$x $rowspan $x++)
                              {
                                 echo 
                          '<tr><td></td><td>' . {addresses[$x][0]} . '</td></tr>';

                              }
                             


                          THE ERROR:
                          Error
                          Array to string conversion
                          Error
                          Array to string conversion
                          Array

                          ---------------------------------------------------------------------------

                          regards

                          ​Bdo

                          Comment


                          • #14
                            I've been whatching the code an actualy tested it.. and it works... can you gimme access or share you project with me so I can take a look. something else, have you change any of the code i gavve you?. if that the case I need the code as it is being executed.

                            Regards

                            Comment


                            • #15
                              Thanks again Kafecadm! here a I send you the code i'm using and also i'm sending the sql table, I'm working in a blank app on execute


                              http://www.librecomercio.cl/download/propiedades.sql
                              http://www.librecomercio.cl/download/propiedades.rar

                              PHP Code:
                              $query_cities "SELECT DISTINCT ciudad FROM propiedades";

                              sc_lookup(cities,$query_cities);

                              foreach({
                              cities} as $City)
                              {
                                 
                              $query_addresses "SELECT DISTINCT direccion FROM propiedades WHERE ciudad = " $City;
                                 
                                
                              sc_lookupaddresses$query_addresses);
                                
                                 
                              $rowspan count({addresses}); // count the number of addresses by city
                                
                                
                                  
                              echo ' <tr><td rowspan ="' $rowspan .'">' $City '<td>' . {addresses[0][0]} .  '</td></tr>';
                                 for ( 
                              $x=$x $rowspan $x++)
                                  {
                                     echo 
                              '<tr><td></td><td>' . {addresses[$x][0]} . '</td></tr>';

                                  }
                                 


                              The Error!
                              Error
                              Array to string conversion
                              Error
                              Array to string conversion
                              Array


                              Comment

                              Working...
                              X