SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    how to pull data

    i m making database thingy. i m stuck on how to pull down data from dynamic link like i have links which get its location by id=1 etc but i dont know how to pull main text related to that link in body.can any1 help
    All those who wander aren't lost.

  2. #2
    SitePoint Addict
    Join Date
    Apr 2006
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you need to look at using the $_REQUEST variable to pull the id parameter. For example

    PHP Code:
    if ($_REQUEST['id'] == 1) { 
      
    # do whatever for id 1


  3. #3
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    thats only with id==1 and id r many so i want relative data puled according to id
    All those who wander aren't lost.

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Pulled from what? A database table?
    Use a query like this:
    PHP Code:
    $query "
      SELECT ....
      FROM tablename
      WHERE id = " 
    mysql_real_escape_string($_GET['id'])

    Of course, instead of dots, you'll have to list the names of the table fields you want to select, and instead of 'tablename' you'll have to put the name of your table.

  5. #5
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i did some research wht i have is 2 tables one has a primary key which is id and table is called catagories and second table is called pages which contain its on id, cat_id (foreign key) and text field. now wht i want when someone click on any field item from catagory table the data to related field comes n show up from the pages table. how do i do that?
    All those who wander aren't lost.

  6. #6
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the links below to read about JOIN types, which is what you would need for what you want.

    MySQL JOIN Syntax


    SQL Joins
    Click the Next button to view the related topics for Inner join, Left join, etc.


Bookmarks

Posting Permissions

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