Jump to content

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..)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.