Jump to content

Storing user data help?


Rifts

Recommended Posts

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

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

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

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 :P (If its wrong sorry I'm tired..)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.