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; ????? Link to comment https://forums.phpfreaks.com/topic/133720-create-vith-other-variables/ 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; Link to comment https://forums.phpfreaks.com/topic/133720-create-vith-other-variables/#findComment-695869 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; ?> Link to comment https://forums.phpfreaks.com/topic/133720-create-vith-other-variables/#findComment-695873 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++; } ?> Link to comment https://forums.phpfreaks.com/topic/133720-create-vith-other-variables/#findComment-695875 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 Link to comment https://forums.phpfreaks.com/topic/133720-create-vith-other-variables/#findComment-695876 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? Link to comment https://forums.phpfreaks.com/topic/133720-create-vith-other-variables/#findComment-695880 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.