chriscloyd Posted November 21, 2008 Share Posted November 21, 2008 say you have already set one variable like so $teamname = $teams['teamname']; then can you do this $team + $teamname = 1; ????? Quote Link to comment Share on other sites More sharing options...
Michdd Posted November 21, 2008 Share Posted November 21, 2008 say you have already set one variable like so $teamname = $teams['teamname']; then can you do this $team + $teamname = 1; ????? That doesn't really make sense but for example you could do $something = 1; $something2 = $something + $somethingelse; Quote Link to comment Share on other sites More sharing options...
flyhoney Posted November 21, 2008 Share Posted November 21, 2008 http://www.php.net/manual/en/language.variables.variable.php Is this what you are trying to do? <?php $teamname = $teams['teamname']; $var = $team . $teamname; $$var = 1; ?> Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted November 21, 2008 Author Share Posted November 21, 2008 no this is what im doing <?php mysql_connect("localhost","*****",'*****'); mysql_select_db("*****"); $get_teams = mysql_query("SELECT * FROM teams WHERE game = 'cs16' AND division = 'a'") or die(mysql_error()); $teamname = array(); $teamcount = 1; while ($teams = mysql_fetch_array($get_teams)) { $teamname[] = $teams['teamname']; } foreach ($teamname as $data) { $t = $data //can i do this somehow //like mane a new variable where the teamname from $t is added into the variable $t_n_$t = $teamcount; $teamcount++; } ?> Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted November 21, 2008 Author Share Posted November 21, 2008 i hope someone understands what im trying to get at Quote Link to comment Share on other sites More sharing options...
flyhoney Posted November 21, 2008 Share Posted November 21, 2008 It can be done using the $$ operator but the question is, why would you ever want to do that? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.