SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: view id

  1. #1
    Non-Member MrLister's Avatar
    Join Date
    Feb 2001
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    view id

    if i have a file called view.php and somebody goes to view.php?action=5 or just view.php?5 it will go to the database and choose where something_id is 5.

    so for example in a database lets say essays there's a row called essay_id and it's value starts at 1 and goes up 1 per essay. so when somebody goes to view.php?5 it will display the essay_text at the bottom. i know how to display the text thing but i need to know how to get that 5 thing. in previous stuff i've done

    if ($action=="something"){

    }

    but i don't think i can do

    if ($action=="$something"){

    $result = mysql_query("select essay_name, $something, essay_text, essay_cat from essays");
    etc...
    }

    thx in advance!

  2. #2
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you do where they go to view.php?page=5 or something like that just do
    Code:
    if ($page) {
    $result = mysql_query("SELECT essay FROM essay WHERE essay_id=$page");
    //etc.
    }
    That says if $page is greater than 0, it'll pull the essay from the DB with an ID of 5.
    Kevin

  3. #3
    Non-Member MrLister's Avatar
    Join Date
    Feb 2001
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh ok. thanks again tubedogg!


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
  •