need help with php [message #445238] |
Thu, 24 March 2011 06:40 ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/22110.jpg) |
renalpha
Messages: 1000 Registered: January 2007 Location: Holland - Zuid-Holland - ...
Karma: 0
|
General (1 Star) |
|
|
Well im not really an expert.
But i was wondering if it is possible to put a var into a var while quering a result into a database.
An example is the following.
$usermenures = mysql_query("SELECT * FROM usermenu ORDER BY id");
while($usermenuget = mysql_fetch_array($usermenures)){
echo '<li class="usermenulist"><a href="'.$usermenuget['link'].'" class="usermenulinks">'.$usermenuget['langnl'].'</a> / </li>';
}
Now you see
I was wondering if i could change langnl into a var, for example.
$usermenuget['$languagevariabele']
$languagevariabele could be langnl for a dutch label and langen for a english lable.
This didn't work, but does anyone know how to get this done?
Aircraftkiller wrote on Fri, 18 February 2011 23:50 | I figured some people will still go LOLOLOL STARVING CATS LOOOOLZ UR A FAG or some dumb shit like that. Thanks for not disappointing! ![Smile](images/smiley_icons/icon_smile.gif)
|
|
|
|
|
|
Re: need help with php [message #445246 is a reply to message #445240] |
Thu, 24 March 2011 14:16 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) |
![](http://renegadeforums.com/images/custom_avatars/20791.jpg) |
Spyder
Messages: 1070 Registered: March 2006
Karma: 0
|
General (1 Star) |
|
|
EvilWhiteDragon wrote on Thu, 24 March 2011 14:47 |
renalpha wrote on Thu, 24 March 2011 14:43 | got it
$mainmenuget[''.$getlang.'']
|
$mainmenuget[$getlang] is better and should work as well. Now you're casting it to a (empty) string, add the content of the var to the string and then adding another empty string to that. Not very useful or efficient.
|
What EvilWhiteDragon said. Also, it wouldn't be a bad idea to read some articles on efficient coding and speeding up your scripts, they often come with handy tips you can use in any situation when coding with php.
|
|
|