Say I have this array for example:
print_r($array);
Prints:
Code: [Select]Array
(
[0] => Array
(
[status] => 0
)
[1] => Array
(
[status] => 1
)
[1] => Array
(
[status] => 0
)
)
Now I have another array:
$color_array = array('0'=>'nocolor','1'=>'green');
How I can do the logic of this?
foreach($array as $tmp){
// Say status holds "1" in this case so it translate to
//$color_array[1]; = green
echo "{$color_array[$tmp['status']]}";
}
Obviously the above generate Illegal offset type. So I cant do that.
Page Reload
I am having issues getting a page to reload after I submit data to a database. This form should input data to a DB and then I want it to reload and list what is in database. I have gotten it to
division gives infinity anser
int main(){ int z=0; int i=1/z; cout<<i;}It doesn't throw any error in Visual Studio 2008. .......What setting one has to change so that it will show runtime error in VS 2008.....
Multi Level Array Problem
hi all,For example I have array like below:$temp = array(array('north america', 'us', 'california'), array('north america', 'us', 'hawaii'), array('north america', 'canada', 'vancouver'),
Cannot Connect to Database
I am writing an application to do annual reviews. I cannot get my script to work. Whenever it runs I get the following error:Code: $username='far'; $password='c00lfarus3r@'; $database='far';Warning:
Mass activity scheduling
Hi experts,
Loop column after 2 results
Hello All.Here is what I have:Client ID Company name Client ID Company nameI then need a script to echo 2 results per row then start a new row.I've tried many
Map.php
I am a complete beginner to PHP and am looking for some help with a program I am messing around with.I found this incomplete source code, and I wanted to finish it, but I have no idea what I am
get the country of visitor and display content based on that
Hello all,I have seen that Google analytics can tell you where a visitor is coming from and I want to do something similar. But I would like to add the functionality of redirecting a user based on his
Install page
How do I make it so when a user submits information on the Install page, it'll right it into the correct file. I can do the forms and $_POST, but I need it so that it actually works.Current stuff in
Amend code to allow multiple attachments
Hi I have a php page that allows the user to browse to a file (image) then sumbit, the confirmation page then has the following code which uploads the said file to the hosting server, but also appends