How would I go about setting a $variable as a result from a sql query and have post the result as datapoint into mysql tabe? What I am trying to accomplish is once a user is logged in, when they make a form subission I want their acctid logged with data entry. The acctid is an autoicrement field that id unique to every user who registers thru my site.
Here's the code I use to pulldown the acctid:
Code: Select all
$acctidquery = mysql_query( "SELECT acctid FROM Users WHERE username ='".$_SESSION['username']."'" )
or die("SELECT Error: ".mysql_error());
while ($get_info = mysql_fetch_row($acctidquery)){
foreach ($get_info as $id);
}
Feel free to advise if there is a better way to run the above. However the query code seemsworks. I tested it by echoing the $acctidquery.
Here's the other part where I have tried to set up a form post variable based on the query result: