-3

picture of codeI have this code:

<?php if(isset($_GET["update"])){
        $id = $_GET["id"] ?? null;

        $where = array("id"=>$id);
        $row = $obj->select_record("medicines",$where);

        ?>

I get this :

Parse error: syntax error, unexpected '?' in C:\wamp\www\New folder\index.php on line 42

Is there any alternative to the above code?

ASR
  • 1,801
  • 5
  • 25
  • 33
alex goot
  • 25
  • 7

1 Answers1

0

You should use:

 $id = $_GET['id']?$_GET['id']:null;
Prasanth Pillai
  • 146
  • 1
  • 13