This topic is locked
[SOLVED]

 When using $ ID = $ _GET ['masterkey1'];..?

11/6/2020 6:25:54 AM
PHPRunner General questions
A
alghanim author

I made an external page to print

And I have a master table and a sub-table of details

When using $ ID = $ _GET ['masterkey1'];

Does not read the current page Example ID 17 Reads 15 What is the correct way to use $ _GET








<?php
require_once("include/dbcommon.php");
$ID= $_GET['masterkey1'];
$sql ="SELECT

`employee_information`.`ID`,

`employee_information`.`name`,

`employee_information`.`Workplace`,

`contractors`.`Installment`,

`contractors`.`Method_Payment`,

`contractors`.`date_payment`,

`contractors`.`ID` AS `ID1`

FROM `employee_information`

INNER JOIN `contractors` ON `employee_information`.`ID` = `contractors`.`ID_employees`and `employee_information`.`ID`='".$ID."'

";
$results = CustomQuery($sql);

$data = db_fetch_array($results);
$ID1 = $data['ID1'];

$name = $data['name'];

$Installment = $data['Installment'];

$Specialization = $data['Specialization'];

$date_payment = $data['date_payment'];


mysqli_close($con);



?>


Please help and thanks everyone

Sergey Kornilov admin 11/10/2020

Since this is the custom page we do not know how do you build this URL or how you use it in your code.
As a rule of thumb - you can use any kind of parameters in the URL i.e.

mypage.php?MyCoolParameter=123


And then in your PHP code, you can use $_GET["MyCoolParameter"] which will have the value of 123.

A
alghanim author 11/10/2020

Thank you for your interest