title: cannot insert any string into mysql
body: <p>I have a problem with inserting strings into mysql. I can insert numbers but cant strings. Can anybody look at this?  Thanks for your help.</p>
  
  <p>My table(episodes) looks like</p>
  
  <pre><code>id  int(11) notnull          
  serie   int(11) notnull          
  name    varchar(255)    notnull          
  comment varchar(255)    notnull          
  embed   varchar(255)    notnull          
  </code></pre>
  
  <p>And here is the PHP code:</p>
  
  <pre><code>&lt;?php
  require_once "config.php";
  
  $connect = mysql_connect( "$db_host", "$db_user", "$db_pw") or die(mysql_error());  
  mysql_select_db("$db_name") or die( mysql_error() );
  
  if(isset($_POST['pridatdiel'])) {   
      mysql_query("INSERT INTO `episodes` (`id`, `serie`, `name`, `comment`, `embed`)
      VALUES ('', '$cisloserie', '$menodielu', '$popis', '$embed')");
      header("refresh: 0;");
  }
  
  function stripinput($text) {
      if (!is_array($text)) {
          $text = stripslash(trim($text));
          $text = preg_replace("/(&amp;amp;)+(?=\#([0-9]{2,3});)/i", "&amp;", $text);
          $search = array("&amp;", "\"", "'", "\\", '\"', "\'", "&lt;", "&gt;", "&amp;nbsp;");
          $replace = array("&amp;amp;", "&amp;quot;", "&amp;#39;", "&amp;#92;", "&amp;quot;", "&amp;#39;", "&amp;lt;", "&amp;gt;", " ");
          $text = str_replace($search, $replace, $text);
      } else {
          foreach ($text as $key =&gt; $value) {
              $text[$key] = stripinput($value);
          }
      }
      return $text;
  }
  
  if(isset($_POST['menodielu'])) {$menodielu = stripinput($_POST['menodielu']);}
  if(isset($_POST['cisloserie'])) {$cisloserie = stripinput($_POST['cisloserie']);}
  if(isset($_POST['popis'])) {$popis = stripinput($_POST['popis']);}
  if(isset($_POST['embed'])) {$embed = stripinput($_POST['embed']);}
  
  echo '    
    &lt;form method="post"&gt;    
    meno dielu&lt;input type="text" name="menodielu"&gt;       
    &lt;select name="cisloserie"&gt;'; 
    $data = mysql_query("SELECT * FROM `series`") or die(mysql_error());   
    while($info = mysql_fetch_array( $data )) 
    {
    echo "&lt;option value=".$info['serie_id']."&gt;".$info['serie_id']."&lt;/option&gt;";
    }
    echo '
    &lt;/select&gt;     
    popis&lt;input type="text" name="popis"&gt;        
    embed&lt;input type="text" name="embed"&gt;      
    &lt;input type="submit" value="pridať diel" name="pridatdiel"&gt;
    &lt;/form&gt;
   ';
  ?&gt;
  </code></pre>