Jump to content

[SOLVED] ?id=


MDanz

Recommended Posts

i have the page.. stack.php

 

I've done the database mysql fields, name and id

I've done the upload page... it uploads a name and id to mysql

 

i've uploaded two records...

 

 

how do i get stack.php to display only id 1 ?

 

e.g.

www.example.com/stack.php?id=1

 

 

So i can use stack.php as a template and have multiple pages, with id represent the data shown on that page.

 

 

any help really appreciated.

 

 

 

Link to comment
Share on other sites

You can use the $_GET array to check for the value of 'id' if you need to:

if(isset($_GET['id']) && is_int($_GET['id'])){
     echo $_GET['id'];
}

 

It's hard to understand your specific request. You might need to post some more code and try to explain more if what I showed you doesn't help.

Link to comment
Share on other sites

You can use the $_GET array to check for the value of 'id' if you need to:

if(isset($_GET['id']) && is_int($_GET['id'])){
     echo $_GET['id'];
}

 

It's hard to understand your specific request. You might need to post some more code and try to explain more if what I showed you doesn't help.

 

 

hi, i've tried e.g. www.example.com/stack.php?id=1 in address bar . this is the upload page

 

<?php
session_start();




if ($_SESSION['username']){

      $stacks= "
      <font color=white>Welcome, ".$_SESSION['username']."!<br><a href='Logout.php'>Log Out</a></font>
      <form enctype='multipart/form-data' action='insert3.php' method='post' name='changer'>
      <p align='center'>
      <input name='name' value='name' type='text'> <br>
           <input type='submit' name='submit' value='Submit'><br></p></form>";
      echo "$stacks";



   }
?>

how can i implement your code into this.  I want it before the if statement. So in the address bar i can type e.g. www.example.com/stack.php?id=1 and get row 1 from my table.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.