Sice offtopic, ale nedá mi to tě neupozornit, kód je nebezpečný a lze snadno napadnout. Přečti si něco o SQL injection.