Created
May 28, 2009 14:10
-
-
Save machal/119324 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Skript, ktery podle vyhledavani v databazi vypise seznam obci pro naseptavac | |
*/ | |
// Pridame stare kodovani, protoze default je utf8 | |
header("Content-Type: text/html; charset=windows-1250"); | |
// Nacteme funkce pro pripojeni k databazi atd. | |
$path = "../"; | |
include $path."inc/funkce.inc.php"; | |
// Hledame | |
$q = strtolower( $_GET["q"] ); | |
if (!$q) return; | |
mysql_connect( $db_host, $db_user, $db_pass ) or die( mysql_error() ); | |
mysql_select_db( $db_name ) or die( mysql_error() ); | |
mysql_query("SET NAMES cp1250"); | |
// Hledame v databazi | |
$data = mysql_query( "SELECT nazev FROM iwfn_obce WHERE UPPER(nazev) LIKE UPPER('$q%')" ) or die( mysql_error() ); | |
// Do pole ulozime a vypiseme vylsedek | |
while( $row = mysql_fetch_array( $data )) { | |
echo $row['nazev'] . "\n"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment