SyncViews Posted April 19, 2008 Share Posted April 19, 2008 74: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 ')' at line 6 <?php ... //update forums $parents_str = ''; foreach($parents as $i=>$parent) { if($i==0)$parents_str . $parent["id"]; else $parents_str . ", $parent[id]"; } $sql->query(" UPDATE forums SET topics=topics+1, posts=posts+1, last_topic_name='$subject', last_topic_id=$topic_id, last_post_id=$post_id, last_post_time=$time, last_user_id=$user_id, last_user_name='$user_name' WHERE forum_id IN ($parents_str) ") or exit(__LINE__.':'.$sql->error); ... Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted April 19, 2008 Share Posted April 19, 2008 $parents_str is probably empty, which means your query has "WHERE forum_id IN ()", which will generate an SQL error. Echo out the query to check. Quote Link to comment Share on other sites More sharing options...
haku Posted April 19, 2008 Share Posted April 19, 2008 $parents_str is probably empty Not just probably - it IS empty! (he defines it as empty at the start of his script). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.