Jump to content

data information from one table to another


Recommended Posts

Hi everyone... I have kind of a complicated problem that i hope someone can help me with.


I have a registration section of my site already up and running... i am trying to create another section of my site so that the user that is logged in can create a posting and link it to their username.... currently i have two tables in a mysql database one named (users) to hold the username and password that i want to pull the username from and another that holds the information for posting called (laf)....


My basic question is how can i pull the username from the (users) database and place it into the (laf) database when they post?


This is a really hard thing to explain i know, if anyone can help or needs any more information let me know...


Thanks in advance

Link to comment
Share on other sites

if you set the username as $_SESSION['user'] then you could use something like this:


mysql_query("INSERT INTO laf (username, data) VALUES('" . $_SESSION['user'] . "', '" . $data. "');


then list like:

mysql_query("SELECT * FROM laf WHERE username='" . $username . "'");

Link to comment
Share on other sites

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.

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.