Note that there are some explanatory texts on larger screens.

plurals
  1. POQuery does not work
    text
    copied!<p>I made this code:</p> <pre><code> Acum, bifeaza materiile pe care le studiaza clasa aleasa:&lt;br /&gt; &lt;form name="servForm" action="&lt;?php $PHP_SELF; ?&gt;" method="post" &gt; &lt;table border="0"&gt; &lt;?php $a = 0; $rezultat = "SELECT id, materie FROM materii ORDER BY id"; $rezultat1 = mysql_query($rezultat); while($plm = mysql_fetch_array($rezultat1)) { if($a++ %5 == 0) echo "&lt;tr&gt;"; ?&gt; &lt;td align="center"&gt;&lt;input type="checkbox" name="checkbox2[]" value="&lt;?php echo $plm['id']; ?&gt;" /&gt;&lt;/td&gt; &lt;td style="text-align:left"&gt;&lt;?php echo $plm["materie"]; ?&gt;&amp;nbsp;&lt;/td&gt; &lt;?php if($a %5 == 0) echo "&lt;/tr&gt;"; } ?&gt; &lt;/table&gt; &lt;/div&gt; &lt;br/&gt; &lt;input type="reset" value="Sterge" /&gt; &lt;input type="submit" value="Salveaza" name="savebtn" /&gt; &lt;/form&gt; &lt;?php if(isset($_POST['savebtn'])) { foreach($_POST["checkbox2"] as $loc_id) { $query = "INSERT INTO materii_pe_clase(id_scoala,id_clasa,id_materie) VALUES('$scoalalui','$clasalui','$loc_id')"; //aici cauta ! :)) $result5 = mysql_query($query) or die('eroare'); }//sfarsit foreact }//sfarsit if isset </code></pre> <p>Why does the last query not work? p.s. its a school project, so mysql is ok, no need for mysqli. p.p.s I defindet the $scoalalui and $clasalui somwhere a little up the page. but they are not the problem, i tried replacing them with values. the query simply does not work. thanks!</p> <p>thank you all!</p> <p>EDIT </p> <p>VARDUMP for $clasalui and $scoalalui :</p> <pre><code>string '1' (length=1) string '1' (length=1) </code></pre>
 

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