Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One thing about that code that would make this hard to figure out is that you are ignoring the success of the query execution, and assuming that it's successful. The <code>$stmt4-&gt;execute()</code> returns a boolean indicating whether or not it was in fact successful. You should be checking that and, if it fails, logging/printing the error.</p> <pre><code>//convert video id array to single lines $pieces = explode(",", $video_ids); //iterate through video IDS in our DB foreach ($pieces as $key) { $sql ="SELECT id, video_name, link, phase FROM videos WHERE id=?"; if ($stmt = $mysqli-&gt;prepare($sql)) { $stmt-&gt;bind_param("i", $key); if ($stmt-&gt;execute()) { $stmt-&gt;bind_result($id, $vid_name, $vid_link, $phase); while ($stmt-&gt;fetch()) { echo "&lt;input type='checkbox' name='checkbox[]' id='$id' value='$id' /&gt;"; echo "&lt;a href='http://www.rotaryswing.com/golf-instruction/video /rst-index.php?cat=$phase&amp;subcat=Rotary%20Swing%20Tour&amp;video=$id&amp;id=$vid_link&amp;name=$vid_name' target=\"blank\"&gt;$vid_name&lt;/a&gt;&lt;br&gt;"; } } else { trigger_error("SQL query failed: " . $stmt-&gt;error, E_USER_ERROR); } } } </code></pre> <p>Now, if the query fails for some reason, this will either log or print the error, depending on your server settings.</p> <p>Also note two things. First, I'm using a parametrized query there, which prevents SQL injection. Second, I've intended the code in a sane manner, making this far easier to read than your code.</p>
 

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