title: How can I incorporate PDO using this coding set up to allow punctuation such as '/" in the fname=$name, $desc, & city column
body: <p>I want to place PDO into my code, but I do not know where to place the coding that will allow me to do that. I want the post in the name field to be able to entered as "mike's", but the current setup does not allow this. I need PDO, and I can't seem to find where exactly I should place the code.</p>
  
  <pre><code>if (isset($_POST['submit'])) {
      $name = $_POST["element_1"];
      $stdatemm = $_POST["element_2_1"];
      $stdatedd = $_POST["element_2_2"];
      $stdateyy = $_POST["element_2_3"];
      $endatemm = $_POST["element_3_1"];
      $endatedd = $_POST["element_3_2"];
      $endateyy = $_POST["element_3_3"];
      $staddr = $_POST["element_4_1"];
      $addr2 = $_POST["element_4_2"];
      $city = $_POST["element_4_3"];
      $state = $_POST["element_4_4"];
      $zip = $_POST["element_4_5"];
      $desc = $_POST["element_5"];
  //$file=$_FILES['element_6'];
      $link = $_POST["element_7"];
      $stdate = $stdatemm . "-" . $stdatedd . "-" . $stdateyy;
      $endate = $endatemm . "-" . $endatedd . "-" . $endateyy;
      $user = $_POST["postuser"];
      if (($_FILES['element_6']['size']) &gt; '0') {
  
          $fileName = $_FILES['element_6']['name'];
          $tmpName = $_FILES['element_6']['tmp_name'];
          $fileSize = $_FILES['element_6']['size'];
          $fileType = $_FILES['element_6']['type'];
  
          if ($fileName != "") {
              if (move_uploaded_file($tmpName, '../login/image/' . $fileName)) {//image is a folder in which you will save image
                  if (!get_magic_quotes_gpc()) {
  
  //$fileName = addslashes($fileName);
                  }
                  $query = "INSERT INTO   test2($name,stdate,endate,addr1,addr2,city,state,zip,name,size,type,content,link,description,user)VALUES('$name','$stdate','$endate','$staddr','$addr2','$city','$state','$zip','$fileName','$fileSize','$fileType','$content','$_POST[element_7]','$desc','$user')";
              }
          }
      }
      else
          $query = "INSERT INTO test2($name,stdate,endate,addr1,addr2,city,state,zip,name,size,type,content,link,description,user)VALUES('$name','$stdate','$endate','$staddr','$addr2','$city','$state','$zip',' ','0',' ',' ','$_POST[element_7]','$desc','$user')";
  
      $q2 = mysql_query($query) or die('Error, query failed' . mysql_error());
      if ($q2) {
          echo "Active";
      } else {
          echo "error";
      }
  }
  $result = mysql_query("SELECT * FROM test2 ORDER BY stdate DESC");
  $data = mysql_query("SELECT stdate FROM test2 ORDER BY id ASC");
  $y = 1;
  echo "&lt;div style='min-height:500px;margin-top: 10px;'&gt;&lt;table style='-moz-border-radius:  15px;border-radius: 15px;border-bottom:1px solid gray;background-color:white;margin:  auto;width: 75%;'&gt;&lt;tr style='font-weight:bold;'&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;Title&lt;/td&gt;&lt;td&gt;Date&lt;/td&gt; &lt;td&gt;City&lt;/td&gt;&lt;/tr&gt;";
  
  while ($row = mysql_fetch_array($result)) {
      echo "&lt;tr&gt;&lt;td&gt;&lt;img src='../login/image/" . $row['name'] . "'  style='width: 125px;height: 94px;'&gt;&lt;/td&gt;";
      echo "&lt;td&gt;&lt;form action='deals.php' method='post' style='margin:0px;'&gt;&lt;input type='hidden' value='" . $row['fname'] . "' name='name'&gt;&lt;input type='submit' style='background-color: white;
  border: none;color: #FF0000;text-decoration: underline;' name='submit2'     value='" . $row['fname'] . "'&gt;&lt;/form&gt;&lt;br/&gt;";
      echo "&lt;/td&gt;&lt;td&gt;" . $row['stdate'] . "&lt;/td&gt;";
      echo "&lt;/td&gt;&lt;td&gt;" . $row['city'] . "&lt;/td&gt;&lt;/tr&gt;";
      $y++;
  }
  echo "&lt;/table&gt;&lt;/div&gt;";
  include("../login/footer.php");
  ?&gt;
  </code></pre>