Mam pewien kod-skrypt, który po uruchomieniu powinien dokonać znaczne zmiany w bazie, jednak...nic się nie dzieje - zero błędów & zero zmian w bazie.
Możecie spojrzeć w kod i nakierować mnie na ew. błędy?
<?php $idbota = $board_config['bot_id']; $urll = $board_config['server_name']; $pathh = $board_config['script_path']; { $sql = "SELECT topic_id, topic_reason, forum_id, topic_action_date FROM " . TOPICS_TABLE . " WHERE topic_status = 1 group by topic_id"; while( $row = $db->sql_fetchrow($result) ) { $topic_id = $row['topic_id']; $reason = $row['topic_reason']; $forum_id = $row['forum_id']; $topic_action_date = $row['topic_action_date']; } { $sql = "SELECT post_id, post_parent, post_order FROM " . POSTS_TABLE . " WHERE topic_id = $topic_id ORDER BY post_order"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, $lang['No_such_post']); } while ( $row = $db->sql_fetchrow($result) ) { if ( $row['post_id'] == $post_data['post_parent'] ) { $post_parent_order = $row['post_order']; $begin_new_parents = 1; } if ( !$row['post_parent'] && !$post_parent_order ) { $begin_new_parents = $order_last_parents = 0; } if ( $begin_new_parents ) { if ( $row['post_parent'] ) { $this_tree_parents[] = $row['post_parent']; } if ( $row['post_id'] == $post_data['post_parent'] || ($row['post_parent'] >= $post_data['post_parent'] && in_array($post_data['post_parent'], $this_tree_parents) ) ) { $order_last_parents = $row['post_order']; } else { $max_order = ($order_last_parents) ? $order_last_parents : $row['post_order']; } } $max_order_all = $row['post_order']; } $max_order = $max_order_all; $post_order = $max_order + 1; $sql = "INSERT INTO ".POSTS_TABLE." (`post_id`, `topic_id`, `forum_id`, `poster_id`, `post_time`, `poster_ip`, `post_username`, `enable_bbcode`, `enable_html`, `enable_smilies`, `enable_sig`, `post_edit_time`, `post_edit_count`, `post_attachment`, `user_agent`, `post_icon`, `post_expire`, `reporter_id`, `post_marked`, `post_approve`, `poster_delete`, `post_edit_by`, `post_parent`, `post_order`) VALUES (".$db->sql_nextid().", '".$topic_id."', '".$forum_id."', '".$idbota."', '".$topic_action_date."', '0', '', '1', '1', '1', '1', '0', '0', '0', '', '0', '0', '0', 'NULL', '1', '0', '0', '0', ".$post_order.")"; { message_die(CRITICAL_ERROR, 'Error1'); } $sql = "INSERT INTO ".POSTS_TEXT_TABLE." (`post_id`, `bbcode_uid`, `post_subject`, `post_text`) VALUES (".$db->sql_nextid().", '0', '', '".str_replace("\'", "''", sprintf($board_config['bot_message'], $reason))."')"; { message_die(CRITICAL_ERROR, 'Error2'); } $sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE forum_id = $forum_id AND topic_id = $topic_id AND poster_id = $idbota"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql); } $result = $db->sql_query($sql); while( $row = $db->sql_fetchrow($result) ) { $post_id = $row['post_id']; } $sql = "UPDATE " . FORUMS_TABLE . " SET forum_last_post_id = $post_id WHERE forum_id = $forum_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql); } $sql = "UPDATE " . TOPICS_TABLE . " SET topic_last_post_id = $post_id WHERE topic_id = $topic_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql); } $sql = "SELECT user_posts FROM " . USERS_TABLE . " WHERE user_id = $idbota"; $result = $db->sql_query($sql); while( $row = $db->sql_fetchrow($result) ) { $posts_bot = $row['user_posts']; } $postss_bot = $posts_bot + 1; $sql = "UPDATE " . USERS_TABLE . " SET user_posts = $postss_bot WHERE user_id = $idbota"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql); } } } ?>
Pozdr.