Rifts Posted November 11, 2009 Share Posted November 11, 2009 Hey Guys, I'm not use if this question is to broad but I can always give you more information if needed. I have a website where users can login which uses mysql anyway I have a little form asking some questions. I need to know how when that user hits submit it will save those answer for that user and then I can go in later as the admin and see what people have submitted? Link to comment https://forums.phpfreaks.com/topic/181057-storing-user-data-help/ Share on other sites More sharing options...
mikesta707 Posted November 11, 2009 Share Posted November 11, 2009 submit the answers to the database? insert? Link to comment https://forums.phpfreaks.com/topic/181057-storing-user-data-help/#findComment-955333 Share on other sites More sharing options...
Rifts Posted November 11, 2009 Author Share Posted November 11, 2009 I don't really know? Thats part of my questions what is best? Link to comment https://forums.phpfreaks.com/topic/181057-storing-user-data-help/#findComment-955356 Share on other sites More sharing options...
Gayner Posted November 11, 2009 Share Posted November 11, 2009 I don't really know? Thats part of my questions what is best? lol bro u dont need to come here to ask everything.. go here, or atleast type in google part of ur questions u know there's trillions of results. lol http://lmgtfy.com/?q=mysql+insert+tutorial win ? click it Link to comment https://forums.phpfreaks.com/topic/181057-storing-user-data-help/#findComment-955361 Share on other sites More sharing options...
mikesta707 Posted November 11, 2009 Share Posted November 11, 2009 use an insert statement with mysql $query = mysql_query("INSERT INTO table (columns) VALUES(values)"); if users can log in, then they must have registered. if you have a register page, then you must have used an insert query... Link to comment https://forums.phpfreaks.com/topic/181057-storing-user-data-help/#findComment-955362 Share on other sites More sharing options...
Rifts Posted November 11, 2009 Author Share Posted November 11, 2009 use an insert statement with mysql $query = mysql_query("INSERT INTO table (columns) VALUES(values)"); if users can log in, then they must have registered. if you have a register page, then you must have used an insert query... oh yes that is exactly what I have. I guess my question is how to I link the information that user submitted to their name Link to comment https://forums.phpfreaks.com/topic/181057-storing-user-data-help/#findComment-955377 Share on other sites More sharing options...
ThunderLee Posted November 11, 2009 Share Posted November 11, 2009 You would have to obtain the users ID from a session, EG, ".$_SESSION['user_id']." Then your query would be something like.. $questionanswer = mysql_real_escape_string($_POST['answer']); qry1 = mysql_query("INSERT INTO tablename (`id`,`questionanswer?`) VALUES (".$_SESSION['user_id'].",$questionanswer) or die(mysql_error()); or something like that (If its wrong sorry I'm tired..) Link to comment https://forums.phpfreaks.com/topic/181057-storing-user-data-help/#findComment-955379 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.