หนู foreach INSERT ไม่เข้า T^T

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: หนู foreach INSERT ไม่เข้า T^T

Re: หนู INSERT ไม่เข้า T^T

by thatsawan » 22/10/2014 6:14 pm

ใส่แบบนี้เข้านะ

Code: Select all

$db->sql_query($sql_a);
exit(); 

หนู foreach INSERT ไม่เข้า T^T

by thatsawan » 22/10/2014 5:56 pm

Code: Select all

if (sizeof($add_groups)){ 
                                foreach ($add_groups as $group => $user_data) {
                                        foreach ($user_data as $id) {
                                        $sql = " SELECT COUNT(*)  FROM ".USER_GROUP_TABLE ." WHERE user_id= ".$id." AND group_id = " .$group ;
                                        $result = $db->sql_query($sql);
                                        $user_group = $db->sql_fetchrow($result);
                                        $sum = $user_group['COUNT(*)'];
                                        if($sum  == 0){
                                                $sql_a = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array(
                                                        'user_id'        => $id,
                                                        'group_id'        => (int) $group,
                                                        'user_pending'    => 0
                                                ));
                                               // exit($sql_a);
                                                $db->sql_query($sql_a);
                                                }
                                        }  
                                }
                        } 
INSERT INTO phpbb_user_group (user_id, group_id, user_pending) VALUES (54, 8, 0)

Top