PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have made up an associative array, what i want to do is display the array key
Here is my array.
So i will display CM2013..
any ideas? I looked at the key function but this must need to be incremented or something as i can only get the first key displayed.
foreach($module_name as $key => $value) {
echo $key;
}
// or
foreach(array_keys($module_name) as $key) {
echo $key;
}
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
code_worm wrote:What about if i want to access them singularly?
i have to populate my table with the keys, 1 key per table cell
I have no idea what you are asking. Maybe a little more explanation.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Ok sorry, In your code you assign all the keys to a variable.
Well what i would really want to do is assign the keys to an array so i can access each key individually.
Im trying to break up your code to try implement it in array form as we speak
Not really got far with this if you could help me out with code that assigns the values to an array rather than the $key variable i would be very gratefull
code_worm wrote:Ok sorry, In your code you assign all the keys to a variable.
Well what i would really want to do is assign the keys to an array so i can access each key individually.
Im trying to break up your code to try implement it in array form as we speak
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
I realised that my problem was because that some keys were identicle which caused a problem but i have now rectified it. Thank you you have saved me time, stress, among other things haha