so as the title says.....
here is the code I currently wrote thinking it would work and it doesnt :(
note my session userid etc is working as I can get it to print out in another field in the form so thats not the problem, but my dropbox just seems to have nothing in it. (i have created the data on the database with the user_id matching of which I am logged in with)
$userid = $_SESSION['myuserid'];
//run query to database
$query = "SELECT * FROM test_groups_tb WHERE user_id='$userid'";
mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($query))
{
$dd .= "{$row['group_name']}";
}
this is then used in the html:
echo $dd; ?>
can somebody help me out?
thanks
解决方案
$query is a string and therefore you cannot get any results from it. You should do something like:
$query = "SELECT * FROM test_groups_tb WHERE user_id='$userid'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
$dd .= "{$row['group_name']}";
}