title: MySQL the right syntax to use near '' at line 1 error
body: <p>hello i have a run a query using php it give error </p>
  
  <p><strong>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1</strong></p>
  
  <p>but when i echo the query and run manually using sqlyog software it runs fine. can anyone say whats the problem on here
  this is my generated query</p>
  
  <pre><code>INSERT INTO wp_bp_activity
              (
              user_id,
               component,
               `type`,
               `action`,
               content,
               primary_link,
               item_id,
               secondary_item_id,
               date_recorded,
               hide_sitewide,
               mptt_left,
               mptt_right
               )
               VALUES(
               1,'activity','activity_update','&lt;a title="admin" href="http://brandnewmusicreleases.com/social-network/members/admin/"&gt;admin&lt;/a&gt; posted an update','&lt;a title="242925_1" href="http://brandnewmusicreleases.com/social-network/wp-content/uploads/242925_1.jpg" class="buddyboss-pics-picture-link"&gt;242925_1&lt;/a&gt;','http://brandnewmusicreleases.com/social-network/members/admin/',' ',' ','2012-06-22 12:39:07',0,0,0
               )
  </code></pre>
  
  <p>and here is my php code</p>
  
  <pre><code>$qr2="INSERT INTO wp_bp_activity
              (
              user_id,
               component,
               `type`,
               `action`,
               content,
               primary_link,
               item_id,
               secondary_item_id,
               date_recorded,
               hide_sitewide,
               mptt_left,
               mptt_right
               )
               VALUES(
               $cid,'activity',
               'activity_update',
               '&lt;a href=\"http://brandnewmusicreleases.com/social-network/members/$name/\" title=\"$name\"&gt;$name&lt;/a&gt; posted an update',
               '&lt;a class=\"buddyboss-pics-picture-link\" href=\"http://brandnewmusicreleases.com/social-network/wp-content/uploads/$imgname\" title=\"$ionlyname\"&gt;$ionlyname&lt;/a&gt;',
               'http://brandnewmusicreleases.com/social-network/members/$name/',
               ' ',
               ' ',
               '$time',
               0,
               0,
               0
               )";
  </code></pre>
  
  <p>after edited</p>
  
  <pre><code>echo $qr2="INSERT INTO wp_bp_activity (user_id,component,`type`,`action`,content,primary_link,item_id,secondary_item_id,date_recorded,hide_sitewide,mptt_left,mptt_right) VALUES($cid,'activity','activity_update','&lt;a href=\"http://brandnewmusicreleases.com/social-network/members/$name/\" title=\"$name\"&gt;$name&lt;/a&gt; posted an update','&lt;a class=\"buddyboss-pics-picture-link\" href=\"http://brandnewmusicreleases.com/social-network/wp-content/uploads/$imgname\" title=\"$ionlyname\"&gt;$ionlyname&lt;/a&gt;','http://brandnewmusicreleases.com/social-network/members/$name/','','','$time',0,0,0)";
  
  mysql_query($qr2) or die(mysql_error());
  </code></pre>