Help PHP Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steven Sinfield

    Help PHP Question

    Hi There,

    I firstly wish to thank those who have helped me:) I have one issue that I
    sort of am lost in the dark, I have searched google without any luch,

    I am passing the following through to a html link

    result.php?1001

    How can I get the query to recognise that number as the WHERE clause
    condition.

    Thanking you in advance.

    Cheers
    Steve


  • eli.hen@gmail.com

    #2
    Re: Help PHP Question

    Using $_GET :

    result.php?num= 1001

    Then use $_GET['num'] to get the number 1001.


    Using $_SERVER['QUERY_STRING'] :

    result.php?1001

    Then use $_SERVER['QUERY_STRING'] to get all the string after the ?
    mark. In this case it will have the number 1001.

    Comment

    • Berimor

      #3
      Re: Help PHP Question

      On Thu, 03 Nov 2005 08:29:38 +0200, <eli.hen@gmail. com> wrote:
      [color=blue]
      > Using $_GET :
      >
      > result.php?num= 1001
      >
      > Then use $_GET['num'] to get the number 1001.[/color]


      or you can use Apache's the mod_rewrite:

      RewriteEngine on
      Options +FollowSymlinks
      RewriteBase /
      RewriteRule ^result\.php\?([\d]+)$ /?num=$1

      (if result.php is in site's root directory)

      this should rewrite request result.php?1001 to result.php?num= 1001
      you can use even better view construction with mod_rewrite:
      RewriteRule ^result\/([\d]+)$ /result.php?num= $1

      will rewrite http://mysite.com/result/1001 to

      [color=blue]
      >
      >
      > Using $_SERVER['QUERY_STRING'] :
      >
      > result.php?1001
      >
      > Then use $_SERVER['QUERY_STRING'] to get all the string after the ?
      > mark. In this case it will have the number 1001.
      >[/color]



      --
      ---
      Exact Meta Search | Major Search Engine

      Comment

      Working...