Danny2k5 Posted April 25, 2006 Share Posted April 25, 2006 Right my query will show "There are 4 results in the download section" after a search but underneath it says "No Results, can anyone see anything wrong with my code?[code]$SEARCH_DOWN_ARRAY = array();$download_query = @mysql_query("SELECT * FROM ti_downloads WHERE d_title LIKE '%$search%' OR d_small_description LIKE '%$search%' OR d_long_description LIKE '%$search%'");$num_downloads = @mysql_num_rows($download_query); $dow = @mysql_fetch_array($download_query);$SEARCH_DOWN_ARRAY[] = array("title" => '<a href="/index.php?action=downloads&cat=' . $catid . '&file=' . $dow["id"] . '" title="' . htmlentities($dow["d_title"]) . '">' . htmlentities($dow["d_title"]) . ' by ' . htmlentities($dow["d_creator"]) . '</a>',"creator" => htmlentities($dow["d_creator"]));$smarty -> assign("NUM_DOWNLOADS", $num_downloads);$smarty -> assign("SEARCH_DOWN_ARRAY", $SEARCH_DOWN_ARRAY);$smarty -> assign("THE_INCLUDE", $smarty -> fetch(SROOT . "templates/search.tpl"));}[/code]Then the template looks like:[code] {section name=down loop=$SEARCH_DOWN_ARRAY} {$SEARCH_DOWN_ARRAY[down].title}<br /> {sectionelse} No Results {/section}[/code]Thanks PeopleDan Link to comment https://forums.phpfreaks.com/topic/8397-loops-with-smarty/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.