Note that there are some explanatory texts on larger screens.

plurals
  1. POParse error while combining multiple query statement
    primarykey
    data
    text
    <p>I wrote a php code to replace SQL row values. But it is not working as expected</p> <p><strong>ERROR : Parse error: syntax error, unexpected T_STRING in ...... on line 3</strong></p> <p>I think i should not use these quotes <code>" "</code> right ? But, when i ran this without <code>" "</code> got this error</p> <p><strong>Error updating comment table: 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 '1' at line 1</strong></p> <p>Here is my Code</p> <pre><code>&lt;?php include_once("db.php"); $sql1 = "update table1 set marks = replace(c2,"NK",'NOKIA')"; $sql2 = "update table1 set marks = replace(c2,"SM",'SAMSUNG')"; $sql3 = "update table1 set marks = replace(c2,"A",'APPLE')"; $sql4 = "update table1 set marks = replace(c2,"CH",'CHINAPECE')"; $sql5 = "update table1 set marks = replace(c2,"WO",'WORLDCLASS')"; if (mysql_query($sql1 &amp;&amp; $sql2 &amp;&amp; $sql3 &amp;&amp; $sql4 &amp;&amp; $sql5)) { echo "Replaced."; } else { echo "Error in replacing: " . mysql_error(); } ?&gt; </code></pre> <p>Thank you!</p> <hr> <p><strong>UPDATE (updated php code with sujjestions sugested by Trinimon and beiller)</strong> </p> <p><strong>ERROR : Parse error: syntax error, unexpected ';' in .... on line 8</strong></p> <pre><code>&lt;?php include_once("db.php"); $sql1 = "update table1 set marks = replace(c2,"NK",'NOKIA')"; $sql2 = "update table1 set marks = replace(c2,"SM",'SAMSUNG')"; $sql3 = "update table1 set marks = replace(c2,"A",'APPLE')"; $sql4 = "update table1 set marks = replace(c2,"CH",'CHINAPECE')"; $sql5 = "update table1 set marks = replace(c2,"WO",'WORLDCLASS')"; if (mysql_query($sql1); mysql_query($sql2); mysql_query($sql3); mysql_query($sql4); mysql_query($sql5);) { echo "Replaced."; } else { echo "Error in replacing: " . mysql_error(); } ?&gt; </code></pre> <p><strong>ERROR : Parse error: syntax error, unexpected ';' in .... on line 8</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload