I have created a tag {search_test} that send a request to the database:
Code: Select all
include "config.php";
if(!($db = @mysql_connect($config['db_hostname'],$config['db_username'],$config['db_password']))) //connect to database
die("couldn't connect to the database.");
if(!@mysql_select_db($config['db_name'],$db)) // Select Database
die("database doesn't exist!");
$sql = "SELECT wc_tipo, wc_pais, wc_start, wc_trabajo FROM wc_test ORDER BY wc_nombre ASC";
// get all the products from the table
$res = mysql_query($sql);
$results = array();
while ($arow = mysql_fetch_array($res)) {
array_push($results, $arow);
}
$smarty->assign('s_tab',$results);
Code: Select all
<form action="get_results.php" method="post">
<p>choose a country:
<select name="Country">
{section name=idx loop=$s_tab}
echo "<option value="{$s_tab[idx].wc_pais}"> {$s_tab[idx].wc_pais}</option><br />";
{/if}
{/section}
</select></p>
Any idea?
I looking for something similar to
Code: Select all
{if $s_tab[idx].wc_pais. != $s_tab[idx+1].wc_pais}