Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Patrick Evans for linking user-id and feedback-id after user login

You should link the feedback and the user at the time of submittion, after inserting to the feedback table you need to also insert into the user-info table if the user is logged in

$sql= "INSERT INTO feedback
       (feedbacktitle, name, email, comment, datetime)
       VALUES('$feedbacktitle', '$name', '$email', '$comment', '$datetime')";
$result = mysql_query($sql);
if($result) {
   $feedbackid = mysql_insert_id();
   if(isset($_SESSION['userid']) && $_SESSION['loggedin'] ) {
       $uid = $_SESSION['userid'];
       $uinfo_sql = "INSERT INTO user-info
       (feedbackid, userid)
       VALUES('$feedbackid','$uid')";
       $uinfoResult = mysql_query($uinfo_sql);
       //etc etc
   }       
}

Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>