if (!mysqli_query($con_self, $own_wall)) { echo "could not write to your wall" . mysqli_error($con_self); } $friend_wall = "INSERT INTO self_comments(usn,foreign_usn,type) VALUES('{$accept}',3,'{$userid}')"; if (!mysqli_query($con_friend, $friend_wall)) { echo "could not write into friends wall" . mysqli_error($con_friend); } $cre_fr_tb = "CREATE TABLE {$accept}(usn CHAR(30),name CHAR(30),time CHAR(30),chat VARCHAR(1000),unfort_time CHAR(30),seen INT DEFAULT 0)"; if (!mysqli_query($con_self, $cre_fr_tb)) { echo "Could not create chat page" . mysqli_error($con_self); } $cre_fr_my_tb = "CREATE TABLE {$userid}(usn CHAR(30),name CHAR(30),time CHAR(30),chat VARCHAR(1000),unfort_time CHAR(30),seen INT DEFAULT 0)"; if (!mysqli_query($con_friend, $cre_fr_my_tb)) { echo "could not register chat tables" . mysqli_error($con_friend); } $friends_other = msyqli_query($con_friend, "SELECT usn FROM my_friends WHERE friendship_status=2"); while ($row5 = mysqli_fetch_assoc($friends_other)) { $fr_others[] = $row5['usn']; $e++; } foreach ($friends_usn as $value) { $con_fr_mine = mysqli_connect("localhost", "root", "", $value); $ins_mine = "INSERT INTO self_comments(usn,foreign_usn,type) VALUES('{$userid}',3,'{$value}')"; if (!mysqli_query($con_fr_mine, $ins_mine)) { echo "Could not write into notification"; } } foreach ($fr_others as $value) { $con_fr_other = mysqli_connect("localhost", "root", "", $value); $ins_other = "INSERT INTO self_comments(usn,foreign_usn,type) VALUES('{$userid}',3,'{$value}')"; if (!mysqli_query($con_fr_other, $ins_other)) {
} $adding_noti_other = "INSERT INTO notification(type,from_usn,from_branch) VALUES(1,'{$userid}','{$accept}')"; if (!mysqli_query($con_central, $adding_noti_other)) { echo "Could not notify" . mysqli_error($con_central); } $comments = $userid . "self_comments"; $own_wall = "INSERT INTO {$comments}(usn,foreign_usn,type) VALUES('{$userid}',3,'{$accept}')"; if (!mysqli_query($con_central, $own_wall)) { echo "could not write to your wall" . mysqli_error($con_central); } $real_comments = $accept . "self_comments"; $friend_wall = "INSERT INTO {$real_comments}(usn,foreign_usn,type) VALUES('{$accept}',3,'{$userid}')"; if (!mysqli_query($con_central, $friend_wall)) { echo "could not write into friends wall" . mysqli_error($con_central); } $friends_other = msyqli_query($con_central, "SELECT usn FROM {$real_friends} WHERE friendship_status=2 AND usn!='{$userid}'"); while ($row5 = mysqli_fetch_assoc($friends_other)) { $fr_others[] = $row5['usn']; $e++; } foreach ($friends_usn as $value) { $friends_connecting = $value . "self_comments"; $ins_mine = "INSERT INTO {$friends_connecting}(usn,foreign_usn,type) VALUES('{$userid}',3,'{$value}')"; if (!mysqli_query($con_central, $ins_mine)) { echo "Could not write to wall"; } } foreach ($fr_others as $value) { $real_friends_connecting = $value . "self_comments"; $ins_other = "INSERT INTO {$real_friends_connecting}(usn,foreign_usn,type) VALUES('{$userid}',3,'{$value}')"; if (!mysqli_query($con_central, $ins_other)) {
function mysql_create_db($database, $link = NULL) { $link = mysql_resolve_link($link); $query = "CREATE DATABASE {$database}"; $result = msyqli_query($link, $query); return !$result ? false : true; }