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

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

Thank you kafecadm I solved!

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 : [TABLE=“border: 1, cellpadding: 1, width: 300”]
[TR]
[TD]City[/TD]
[TD]Adress[/TD]
[/TR]
[TR]
[TD]Santiago[/TD]
[TD]Bilbao 8978[/TD]
[/TR]
[TR]
[TD]Santiago[/TD]
[TD]Las Condes 7458[/TD]
[/TR]
[TR]
[TD]Santiago[/TD]
[TD]Santa Rosa 56210[/TD]
[/TR]
[/TABLE]
How can I do to get this results [TABLE=“border: 1, cellpadding: 1, width: 300”]
[TR]
[TD]City[/TD]
[TD]Adress[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Bilbao 8978[/TD]
[/TR]
[TR]
[TD]Santiago[/TD]
[TD]Las Condes 7458[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Santa Rosa 56210[/TD]
[/TR]
[/TABLE]

make 2 queries:

 

$query_cities = "SELECT DISTINCT ciudad FROM propiedades";

sc_lookup( cities , $query_cities );

foreach( {cities} as $City)
{
   $query_addresses = "SELECT DISTINCT direcci?n FROM propiedades WHERE ciudad = " . $City;
   
  sc_lookup( addresses, $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=1 ; $< $rowspan ; $x++)
    {
       echo '<tr><td></td><td>"{addresses[0][$x]}"</td></tr>';

    }
   

}


hope this helps even if it has some errors…

regards

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 abla_agrupaciones\index.php on line 1116

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


$query_cities = "SELECT DISTINCT ciudad FROM propiedades";

sc_lookup( cities , $query_cities );

foreach( {cities} as $City)
{
   $query_addresses = "SELECT DISTINCT direcci?n FROM propiedades WHERE ciudad = " . $City;
   
  sc_lookup( addresses, $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=1 ; $< $rowspan ; $x++)
    {
       echo '<tr><td></td><td>' . {addresses[0][$x]} . '</td></tr>';

    }
   

}  





There?.

Regards

No yet, There is a little error but i don’ know which is it,

Regards

replace {addresses[0][$x]}

use

{addresses[$x][0]}

instead.

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

need a lil bit more information, could you please show me the error you’re receiving?.

Regards

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 ’ <tr><td rowspan ="’ . $rowspan .’">’ . $City . ‘<td>’ . {addresses[0][0]} . ‘</td></tr>’;
for ( $x=1 ; $x < $rowspan ; $x++)
{
echo ‘<tr><td></td><td>’ . {addresses[$x][0]} . ‘</td></tr>’;

}

}


THE ERROR:
[TABLE=“class: scErrorTable , align: center, cellpadding: 0, cellspacing: 0”]
[TR=“class: cke_show_border”]
[TD=“class: scErrorTitle, align: left”]Error[/TD]
[/TR]
[TR=“class: cke_show_border”]
[TD=“class: scErrorMessage, align: center”]Array to string conversion[/TD]
[/TR]
[/TABLE]
[TABLE=“class: scErrorTable , align: center, cellpadding: 0, cellspacing: 0”]
[TR=“class: cke_show_border”]
[TD=“class: scErrorTitle, align: left”]Error[/TD]
[/TR]
[TR=“class: cke_show_border”]
[TD=“class: scErrorMessage, align: center”]Array to string conversion[/TD]
[/TR]
[/TABLE]
Array


regards

​Bdo

Last 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 ' <tr><td rowspan ="' . $rowspan .'">' . $City . '<td>' . {addresses[0][0]} .  '</td></tr>';
   for ( $x=1 ; $x < $rowspan ; $x++)
    {
       echo '<tr><td></td><td>' . {addresses[$x][0]} . '</td></tr>';

    }
   

} 

THE ERROR: [TABLE=“class: text_table_scErrorTable, align: center”]
[TR=“class: text_table_cke_show_border”]
[TD=“class: text_table_scErrorTitle, align: left”]Error[/TD]
[/TR]
[TR=“class: text_table_cke_show_border”]
[TD=“class: text_table_scErrorMessage, align: center”]Array to string conversion[/TD]
[/TR]
[/TABLE]

[TABLE=“class: text_table_scErrorTable, align: center”]
[TR=“class: text_table_cke_show_border”]
[TD=“class: text_table_scErrorTitle, align: left”]Error[/TD]
[/TR]
[TR=“class: text_table_cke_show_border”]
[TD=“class: text_table_scErrorMessage, align: center”]Array to string conversion[/TD]
[/TR]
[/TABLE]

Array


regards

​Bdo

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

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

$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 ' <tr><td rowspan ="' . $rowspan .'">' . $City . '<td>' . {addresses[0][0]} .  '</td></tr>';
   for ( $x=1 ; $x < $rowspan ; $x++)
    {
       echo '<tr><td></td><td>' . {addresses[$x][0]} . '</td></tr>';

    }
   

} 

The Error!
[TABLE=“class: scErrorTable, align: center, cellpadding: 0, cellspacing: 0”]
[TR]
[TD=“class: scErrorTitle, align: left”]Error[/TD]
[/TR]
[TR]
[TD=“class: scErrorMessage, align: center”]Array to string conversion[/TD]
[/TR]
[/TABLE]
[TABLE=“class: scErrorTable, align: center, cellpadding: 0, cellspacing: 0”]
[TR]
[TD=“class: scErrorTitle, align: left”]Error[/TD]
[/TR]
[TR]
[TD=“class: scErrorMessage, align: center”]Array to string conversion[/TD]
[/TR]
[/TABLE]
Array

There you go boy… FIXED


$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[0] . "'";
   
  sc_lookup( addresses, $query_addresses);
  
   $rowspan = count({addresses}); // count the number of addresses by city
  
   echo '<table>
                   <tr>
                    <td rowspan ="' . $rowspan .'">' . 
                                   $City[0] . 
                       '</td>
                    <td>' . 
                                   {addresses[0][0]} .  
                       '</td>
                </tr>';
   for ( $x=1 ; $x < $rowspan ; $x++)
    {
       echo '<tr>
                <td>' . 
                       {addresses[$x][0]} . '
                </td>
            </tr>';

    }
   echo '</table>';

}  


Very good!! now it’s work , thank you very much