Farhad paikan Farhad paikan - 1 year ago 62
MySQL Question

Retrieve data from mysql database and insert it in a table using php

I design 3 pages in html with bootstrap framework, one is i can insert data to database the second it shows subject and date of the data i inserted in database in a html table and i want the 3rd page to get data from database when i click on recorded data in table and show it in the 3rd page.

| No | Subject | Date |
| 1 | A | 2016 |
| 2 | B | 2016 |

when i click on A i want to get data about A project from Database and when i click on B i want to get details about B project in another Page from databse.

i don't have any idea how to do that with php and html.

sorry for bad English

Answer Source

Pass Project No with GET Variable and retrieve that data with that ID in 3rd page like this :

Second Page :

    <td><a href="localhost/3rdpage.php?id=<?=$project->no;?>">Details</a></td>

Third Page :

$projectNo = $_GET['id'];

$stmt = $pdo->prepare('SELECT * FROM project WHERE no = ?');
$data = $stmt->fetch(PDO::FETCH_OBJ);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download