title: Mysql Unable to make a query
body: <p>I am trying to put some data in to my MySQL table using PHP. I'm already retrieving some data into a variable from the database. Let us say it is: </p>
  
  <pre><code>$data = "Some variable";
  </code></pre>
  
  <p>But the problem is that in the place of 
  <code>Some variable</code> I have data like this</p>
  
  <pre><code>$data = $row['some data'];
  </code></pre>
  
  <p>I don't know what I am fetching may be some time it may be hyper links may be some time it may be just some junk data. Problem arises when I try to put  data into MySQL table.</p>
  
  <p>I tried to echo out the query suppose this is the query</p>
  
  <pre><code>$query = "INSERT into table VALUES(0, '$data')";
  </code></pre>
  
  <p>The output was:</p>
  
  <pre><code>INSERT INTO table VALUES(0,'Donatted book:'25 ways to improve life');
  </code></pre>
  
  <p>Here there is an upper quotation after donated book. But I can't change it because the data comes over here is from another database. How do I make this insert command work.</p>
  
  <p>Here is how my code is working</p>
  
  <pre><code>&lt;?php
      $query = "SELECT*from table WHERE id=$content_id";
      $data = mysqli_query($dbc, $query);
      $row = mysqli_fetch_array($data);
      $data = $row['col'];
  
      $query2 = "INSERT INTO table VALUES(0, $data)";
      mysqli_query($query2);
  ?&gt;
  </code></pre>