MySQL / PHP dating site

Out of context: Reply #23

  • Started
  • Last post
  • 40 Responses
  • drgss0

    Shouldn't it be if($result && $result2)? $query and $query2 are strings

    Btw, $result2 returns success boolean only for the last interest insert, which is probably ok. If at least the last one is ok, then the rest are too, and if something is wrong with the client_interests table, the whole row should fail

    But to be extra anal about it , to check if all interests are inserted
    $result2 = TRUE;
    $interests_array = array_map('trim', explode(',', $interests));
    foreach ($interests_array as $interest) {
    $query2 = "INSERT INTO client_interests(client_id, interest) ". "VALUES ('$insert_id', $interests')";
    $result2 = $result2 && mysqli_query($oConn, $query2) or die('Error querying database.');
    }

    Also, it should be "Your last name" on line 57

View thread