$query2=$DB_site->query("SELECT * FROM savethreads WHERE saveuser='$username'"); while ($row = $DB_site->fetch_array($result)) { $savethreadid = $row["savethreadid"]; echo("$savethreadid"); }