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
https://forums.phpfreaks.com/topic/171371-solved-id/
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
https://forums.phpfreaks.com/topic/171371-solved-id/#findComment-903774
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
https://forums.phpfreaks.com/topic/171371-solved-id/#findComment-903833
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.