title: mysql not accepting apostrophe '
body: <p>need help inputs are not inserted to db when there is an apostrophe in the textfield values, im trying to use the codes below to escape the ' but its not working,</p>
  
  <pre><code>function myaddslashes($string){ 
      if(get_magic_quotes_gpc() == 1){ 
          return $string; 
      } else { 
          return str_replace("'", "''", $string); 
      } 
  }  
  </code></pre>
  
  <p>ive used this as well to no avail:</p>
  
  <pre><code>function check_input($value)
  {
  // Stripslashes
  if (get_magic_quotes_gpc())
    {
    $value = stripslashes($value);
    }
  // Quote if not a number
  if (!is_numeric($value))
    {
    $value = "'" . mysql_real_escape_string($value) . "'";
    }
  return $value;
  }
  </code></pre>
  
  <p>here is my php code:</p>
  
  <pre><code>&lt;?php
      error_reporting(0);
      require 'include/DB_Open.php';
  
      $RemedyTicketNo = $_POST['RemedyTicketNo'];
      $PhoneNumber = $_POST['PhoneNumber'];
      $Category2 = $_POST['Category2'];
      $Category3 = $_POST['Category3'];
      $Status = $_POST['Status'];
      $Createdate = $_POST['Createdate'];
      $Date = $_POST['Date'];
      $Severity = $_POST['Severity'];
      $BanType = $_POST['BanType'];
      $XiD = $_POST['XiD'];
      $Ticket = $_POST['Ticket'];
  
      if (isset($RemedyTicketNo)) 
      {
      $sql="INSERT into tbl_main (ars_no, phone_number, category_1, category_2, status, create_date, resolved_date, trouble_type_priority, ban_type, employee_id_name) 
            VALUES ('".$RemedyTicketNo."', '".$PhoneNumber."', '".$Category2."', '".$Category3."', '".$Status."', '".$Createdate."', '".$Date."', '".$Severity."', '".$BanType."', '".$XiD."')";
      $result=mysql_query($sql);
  
      header("Location: wireless_new.php");
      }
  
  ?&gt;
  </code></pre>
  
  <p>P.S...im new to php and sql so im still trying to learn to use sqli...</p>