Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Technical Support » Other » need help with php
need help with php [message #445238] Thu, 24 March 2011 06:40 Go to next message
renalpha is currently offline  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> /&nbsp;</li>';
			}



Now you see
$usermenuget['langnl']


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

Re: need help with php [message #445239 is a reply to message #445238] Thu, 24 March 2011 06:43 Go to previous messageGo to next message
renalpha is currently offline  renalpha
Messages: 1000
Registered: January 2007
Location: Holland - Zuid-Holland - ...
Karma: 0
General (1 Star)
got it

$mainmenuget[''.$getlang.'']


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

Re: need help with php [message #445240 is a reply to message #445239] Thu, 24 March 2011 06:47 Go to previous messageGo to next message
EvilWhiteDragon is currently offline  EvilWhiteDragon
Messages: 3751
Registered: October 2005
Location: The Netherlands
Karma: 0
General (3 Stars)

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.


http://www.blackintel.org/usr/evilwhitedragon/pointfix.gif
BlackIntel admin/founder/PR dude (not a coder)
Please visit http://www.blackintel.org/

V, V for Vendetta

People should not be afraid of their governments.
Governments should be afraid of their people.
Re: need help with php [message #445246 is a reply to message #445240] Thu, 24 March 2011 14:16 Go to previous message
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.
Previous Topic: svchost.exe has a trojan
Next Topic: Need help with my C++ code
Goto Forum:
  


Current Time: Sat Apr 27 22:36:34 MST 2024

Total time taken to generate the page: 0.00607 seconds