Jump to content

create $ vith other variables


chriscloyd

Recommended Posts

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;

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++;
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.