$style = $DB_site->query("SELECT title FROM user u, style s WHERE u.userid = '$userinfo[userid]' AND s.styleid = u.styleid"); while ($styleinfo=$DB_site->fetch_array($style)) { $styleinfouser=$styleinfo[title]; }