Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, I would set this line at the top of the script to enable all errors:</p> <pre><code>error_reporting(-1); </code></pre> <p>Then, I would print something on the screen to see if you script goes in the "true" part of the "if" or in the "false" (else).</p> <p>Finally, I would dump on the screen all the variable you put in your SELECT statement. Your variables are not escaped so it may be the reason why you have an error. Outputing the SQL statement and running it directly in MySQL will also tell you if the error comes from that part.</p> <p>Any quote (single or double) in your data may have an impact on your SQL.</p> <p>Edited code would be:</p> <pre><code> for ($z = 0; $z &lt; count($track); $z++) { if ( in_array($track[$z], $already_track)){ $at_key = array_search($track[$z], $already_track); $a = explode(":", $artist[$z]); $b = explode(":", $already_artist[$at_key]); $array_compared = array_diff($a, $b); if(empty($array_compared)){ continue; } else { $sql = "INSERT INTO tracklist(aid, sid, rid, added_by, added_on) VALUES('".$album."', '".$track[$z]."', '".$artist[$z]."', '".$_SESSION["userkey"]."', '" . $time . "' )"; echo 'First else.'; var_dump($track, $artist, $album, $_SESSION["userkey"]); $res = mysql_query($sql); var_dump($res); } } else { $sql = "INSERT INTO tracklist(aid, sid, rid, added_by, added_on) VALUES('".$album."', '".$track[$z]."', '".$artist[$z]."', '".$_SESSION["userkey"]."', '" . $time . "' )"; echo 'Second else.'; var_dump($track, $artist, $album, $_SESSION["userkey"]); $res = mysql_query($sql); var_dump($res); } } </code></pre> <p>Hope it helped!</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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