Bluehost.com Web Hosting $6.95

Half solved (was foreach in search)

This is a discussion on Half solved (was foreach in search) within the PHP General forums, part of the PHP Programming Forums category; Hi, I am getting a lits of GET values and dumping the variable and the value into an array like ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-10-2003
Ryan A
 
Posts: n/a
Default Half solved (was foreach in search)

Hi,
I am getting a lits of GET values and dumping the variable and the value
into an array like so:

$xxx=0;
foreach ($_GET as $a => $v) {
print "Current value of \$a:$a and \$v $v.\n <br>";
$test=$a."=".$v;
$test1[$xxx]="".$test;
$xxx++;
}

So now $test1[] contains the whole GET's variables and values, how do i
pharse it so that i can dump all the $test[]s data like so:

$someVar=$test[0]. "&" .$test[1]. "&" .$test[2].....etc

Kindly help.

Thanks,
-Ryan



We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com


Reply With Quote
  #2 (permalink)  
Old 08-10-2003
Skate
 
Posts: n/a
Default Re: [PHP] Half solved (was foreach in search)


>
> $someVar=$test[0]. "&" .$test[1]. "&" .$test[2].....etc
>


$someVar = implode( "&", $test );

.... should do the trick


Reply With Quote
  #3 (permalink)  
Old 08-10-2003
Ryan A
 
Posts: n/a
Default Re: [PHP] Half solved (was foreach in search)

implode.....why the #@%# didnt i think of that??
Thanks dude.
Just one last question, the last variable i am getting is page=1, how do i
increase this?
Basically I need to do a $page++

Thanks,
-Ryan


We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com


----- Original Message -----
From: "skate" <root@fatcuban.com>
To: "Ryan A" <ryan@jumac.com>; <php-general@lists.php.net>
Sent: Sunday, August 10, 2003 9:23 PM
Subject: Re: [php] Half solved (was foreach in search)


>
> >
> > $someVar=$test[0]. "&" .$test[1]. "&" .$test[2].....etc
> >

>
> $someVar = implode( "&", $test );
>
> ... should do the trick
>
>


Reply With Quote
  #4 (permalink)  
Old 08-11-2003
Skate
 
Posts: n/a
Default Re: [PHP] Half solved (was foreach in search)


> implode.....why the #@%# didnt i think of that??
> Thanks dude.
> Just one last question, the last variable i am getting is page=1, how do i
> increase this?
> Basically I need to do a $page++
>


so do it then....

$xxx=0;
foreach ($_GET as $a => $v) {
print "Current value of \$a:$a and \$v $v.\n <br>";
if( $a = "page" )
$v++;
$test=$a."=".$v;
$test1[$xxx]="".$test;
$xxx++;
}


does that look right? i think that's what your after anyway...


Reply With Quote
  #5 (permalink)  
Old 08-11-2003
Skate
 
Posts: n/a
Default Re: [PHP] find string


>
> if ($action!='a1' || $action!='a3') //tried == also
> {
> //do stuff
> }
> else
> {
> //do other stuff
> }
>


the logic behind this particular one doesn't work... if it's either not one,
or not the other... it'll always be true... unless both are set to exactly
the same...

the logic if($action=="a1" || $action == "a3" ) should work find tho, coz
it's checking to see if either is true...

check what $action is actually set to by doing a print just before your if
statement, and then stick two print's inside the if... true and false, in
the respective place...

hope this helps...


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:53 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0