Jump to content

Recommended Posts

Hi,

Im battling here to get "only" certain values from a "akey" and "value" query..

 

I have a list of items around 200 id's strong, i only want to pull cirtain values from the list,

the table structure is like so:

id, akey, value

 

// i don't know the values of the specific akey's or their id's but i do know the akey value.

what i am trying to do is only pull the values that are in the "getConfigTitle's" list below (this list is only a sample the actual list is around 100 strong)

here is my code sample:

 


	$query="SELECT akey,value FROM settings WHERE LOWER(akey) LIKE getConfigTitles();";
	$settingsList=doSelectSql($query);
	foreach ($settingsList as $set)
		{
		$r=array();
			$r['CONFIGTITLE']=getConfigTitles();
			$r['KEY'] = $set->akey;
			$r['SETTING'] = $set->value;
			$rows[]=$r;
		}

function getConfigTitles()
	{
	$titles=array();
	$titles['search']= "search" ;
	$titles['viewprofile']= "viewprofile" ;
	$titles['editprofile']= "editprofile" ;
	$titles['dashboard']= "dashboard" ;
	$titles['preview']= "preview" ;
	return $titles;
	}

Thanks for the reply.

is it that simple?? im going to give it a go.. i was hoping i could use the already made function somehow as there are 100+ specifics i need to get, i wanted to avoid all that writing AGAIN!.. i also have other queries like this one.. :(

 

In the meantime i will try it this way..

thanks

xyph

You can use the given function. Take a look at the array functions PHP has to offer.

http://php.net/manual/en/ref.array.php

 

I'm sure there's something in there that involves turning an array into a delimited string ;)

agg this is working perfectly xyph. It wasn't as hard to create the list as i thought, a little CTRL+H magic and all was 2 minutes worth :D..

 

I do like the page you sent me though... lots of interesting stuff there..

Thanks again

Best regards

Antony..

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.