www.webdeveloper.com
Results 1 to 3 of 3

Thread: SELECT query...question?

  1. #1
    Join Date
    Nov 2002
    Location
    Scotland
    Posts
    550

    SELECT query...question?

    Hello,

    I have seen on some sites the address bar looks like ...

    PHP Code:
    http://www.jim.com/footwear.php?type=footwear&stype=nike 
    How does this work? I mean, the two parameters in the query string, how does it work with the SQL SELECT query, does it change?

    I basically have a link on my site that I want users to click so that it will only show stuff from the database where type equals footwear and stype is nike...is it easy to do ?

    Code:
    $query2 = "SELECT i.id, i.type, i.stype, t.id, t.type, s.id, s.stype, i.name, i.description, i.price, i.date, i.largeimageone FROM items as i, type as t, stype as s WHERE i.type = t.id AND t.type = $type AND i.stype = s.id AND s.stype = $stype LIMIT 40";
    Any ideas ?
    Last edited by invision; 06-19-2006 at 08:56 AM.

  2. #2
    Join Date
    Jun 2006
    Posts
    39
    if address
    Code:
    http://www.jim.com/footwear.php?type=footwear&stype=nike
    Then to query database:

    PHP Code:
    $type=$_GET['type'];
    $stype=$_GET['stype'];
    $query="SELECT * FROM table_name WHERE type='$type' AND stype='$stype'"
    Easy as pie

  3. #3
    Join Date
    Apr 2003
    Location
    Rosemount, MN
    Posts
    2,287
    PHP Code:
    $type $_GET['type'];
    $stype $_GET['stype'];

    $query2 "SELECT i.id, i.type, i.stype, t.id, t.type, s.id, s.stype, i.name,
     i.description, i.price, i.date, i.largeimageone FROM items as i, type as t, stype
    as s WHERE i.type = t.id AND t.type = 
    $type AND i.stype = s.id AND s.stype = $stype LIMIT 40"
    My settings

    Browser :: FireFox 1.5
    Resolution :: 1152x864
    Connection :: Cable Modem 2Mbs

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles