RE: [PHP-DB] or statement in url
or alternatively just do something similar to what you did, using either the in-built array handling, or your own string manipulation ie. http://url.com/page.php?var1=foo http://url.com/page.php?var1=bar could be either; http://url.com/page.php?var[]=foo&var[]=bar ($_GET["var"] will be an array with "foo" and "bar" as elements 0 and 1) OR http://url.com/page.php?var=foo,bar then $var = explode(",", $_GET["var"]); now, as above, $var is an array with the 2 terms HTH Beau // -Original Message- // From: Martin Clifford [mailto:[EMAIL PROTECTED]] // Sent: Friday, 19 July 2002 4:36 AM // To: [EMAIL PROTECTED]; [EMAIL PROTECTED] // Subject: Re: [PHP-DB] or statement in url // // // Pass different variables and use them both in your query. // // http://www.xyz.com/foo.php?FooID=1 // http://www.xyz.com/foo.php?Foo2ID=2 // // $query = "SELECT * FROM table WHERE id=$FooID OR id=$Foo2ID"; // // HTH // // Martin Clifford // Homepage: http://www.completesource.net // Developer's Forums: http://www.completesource.net/forums/ // // // >>> "Matthew K. Gold" <[EMAIL PROTECTED]> 07/18/02 04:20PM >>> // can I use an OR operator in a variable that is passed through a url? // // ex. how can I combine the following two lines so that I end // up with records // that have an id of either 1 or 2? // // http://www.xyz.com/foo.php?FooID=1 // // http://www.xyz.com/foo.php?FooID=2 // // (I tried the following, but it didn't work: // http://www.xyz.com/foo.php?FooID=1||FooID=2 ) // // thanks in advance for your help. // // Matt // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, visit: http://www.php.net/unsub.php // // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, visit: http://www.php.net/unsub.php // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] or statement in url
How about http://www.xyz.com/foo.php?FooID[]=1&FooID[]=2 Then FooID will be an array of the values. -Steve On Thursday, July 18, 2002, at 03:20 PM, Matthew K. Gold wrote: > can I use an OR operator in a variable that is passed through a url? > > ex. how can I combine the following two lines so that I end up with > records > that have an id of either 1 or 2? > > http://www.xyz.com/foo.php?FooID=1 > > http://www.xyz.com/foo.php?FooID=2 > > (I tried the following, but it didn't work: > http://www.xyz.com/foo.php?FooID=1||FooID=2 ) > > thanks in advance for your help. > > Matt > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] or statement in url
Pass different variables and use them both in your query. http://www.xyz.com/foo.php?FooID=1 http://www.xyz.com/foo.php?Foo2ID=2 $query = "SELECT * FROM table WHERE id=$FooID OR id=$Foo2ID"; HTH Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> "Matthew K. Gold" <[EMAIL PROTECTED]> 07/18/02 04:20PM >>> can I use an OR operator in a variable that is passed through a url? ex. how can I combine the following two lines so that I end up with records that have an id of either 1 or 2? http://www.xyz.com/foo.php?FooID=1 http://www.xyz.com/foo.php?FooID=2 (I tried the following, but it didn't work: http://www.xyz.com/foo.php?FooID=1||FooID=2 ) thanks in advance for your help. Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] or statement in url
can I use an OR operator in a variable that is passed through a url? ex. how can I combine the following two lines so that I end up with records that have an id of either 1 or 2? http://www.xyz.com/foo.php?FooID=1 http://www.xyz.com/foo.php?FooID=2 (I tried the following, but it didn't work: http://www.xyz.com/foo.php?FooID=1||FooID=2 ) thanks in advance for your help. Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php