Jump to content

Array_map maybe? Help please


chuco08

Recommended Posts

So I am attempting to write a little PHP app that will store my passwords to various sites.  It's pretty basic stuff just a way to continue progressing with my PHP skills.  I am admittedly stuck with my current objective which would have all websites be echoed out into my table as click able links.

 

Basically my data is stored in a mysql table which I pull out into an array as follows:

 

array([id] => 1, [name] => joe.user, [site] => myspace.com)

array([id] => 2, [name] => joe.user, [site] => facebook.com)

 

This list will grow obviously as I begin to populate data in it.  Currently I have been trying to play with array_map function and have been successfully been able to turn every item in the array into a clickable link.

 

My questions would be, how would I only mainpulate the array['site] value while leaving everything else alone at least for now.  Is array_map the way to go or maybe a foreach loop would be best.  Please help?

Link to comment
https://forums.phpfreaks.com/topic/166863-array_map-maybe-help-please/
Share on other sites

if your array was called $info then simply use

 

$info['site'] = "myspace.com";

 

Since you have an array of sites you can use the array index first like so

 

$info[0]['site'];

 

Remeber arrays start from 0 so this would be your first array.

 

 

 

 

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.