Hi,

I am trying to create a script for a 'social network' system. The idea is that USER1 (follow_user_id) can follow USER 2 (user_id)

The table is 'follow' but I cant seem to get it to work. Does anyone have any suggestions on what I can try. All I can currently do is echo the ID of the person who is logged in from the first line of code.


Code:
<?php 
$id = $_SESSION['userID']; 
if (($_GET['do'] == 'follow') && !empty($_GET['id'])) { 
         // check if user is logged in 
         if (($_SESSION['auth']) && !empty($_SESSION['current_user_id'])) { // whatever your $_SESSION variable is for logged in users 
                         if ($_SESSION['current_user_id'] == $_GET['current_user_id']) { 
                                         // other checks here to determine various ID's are numeric, etc. 
                                         $sql = "INSERT INTO `follow` (`user_id`, `follow_user_id`) VALUES (". (int)$_SESSION['current_user_id'] .", ". (int)$_GET['id'] .")"; 
                                         if (!mysql_query($sql)) { 
                                                         if (mysql_errno($link_identifier) == 1062) { //$link_identifier is necessary to avoid conflicting 
error notices due to multiple openning/closing SQL connections 
                                                                         // duplicate attempt to follow 
                                                                         // handle accordingly 
                                                         } 
                                         } 
                         } 
         } 
} 
?> 
</div> 
<div class="forminputcell"> 
         <div class="datainput"> 
                         <div class="forminputleft"> 
                                         Follow: 
                         </div> 
                         <div class="followbutton"> 
                                         <a href="<?php echo $_SERVER['PHP_SELF']; ?>?do=follow&id=354"><img src="/images/follow.png" class="submit-button"/></a> 
                         </div> 
         </div> 
</div> 
</div> 
<?php echo $id; ?> <br> 
<?php echo $current_user_id; ?> <br> 
 
 
</div>