Jump to content

Getting an array from a link


dannybrazil

Recommended Posts

Hey guys

I have a question that I hope you can help me with...

 

I have a link that looks something like that

 

www.mysite.com?id-1=123&id-2=456....id-(n)=i

*could be 1 ID or 100 id's passed on with the link

 

what I wanted to know is how can I put all of these id's into a sql query

 

and get a specific info' for each of these id's

 

I need it to be some kind of a loop or something...I dont know

 

ex:

for each id I want a DIV with some info

 

<div>//id=1

echo $row['address'];

echo $row['phone'];

</div>

 

<div>//id=2

echo $row['address'];

echo $row['phone'];

</div>

.

.

<div>//id=i

echo $row['address'];

echo $row['phone'];

</div>

 

some king of a loop till he echoes the last ID# from the link

 

any one ?

Link to comment
https://forums.phpfreaks.com/topic/194963-getting-an-array-from-a-link/
Share on other sites

I think you broke the record of "time to respond" Thanks

 

well as I mentioned Im a newbie ...

 

After your code here

$ids = array();
foreach($_GET as $key => $value)
{
      if(substr($key,0,2) == 'id')
      {
            $ids[] = $value;
      }
}

 

How should I SQL it exactly....

 

eventually I need to get something like that:

 

 

<div>//id=1

echo $row['address'];

echo $row['phone'];

</div>

 

<div>//id=2

echo $row['address'];

echo $row['phone'];

</div>

.

.

<div>//id=i

echo $row['address'];

echo $row['phone'];

</div>

 

 

 

 

If you can help me it will be great

 

Danny

 

 

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.