am stuck on some lines even after reading several tutorials and answers.

// set up a row for each record
       echo "<tr>";

        echo "<td><a href='vieworder.php?ID='>" . $row->ID . "</a></td>";
        echo "<td>" . $row->Subject . "</td>";
        echo "<td>" . $row->Level . "</td>";
        echo "<td>" . $row->Deadline . "</td>";

        echo "</tr>";

the above code fetches some records from the database. i am trying to create alink such that when someone clicks on the link with ID it opens in a new window (vieworder.php).

if ($result = $mysqli->query("SELECT * FROM placeorder WHERE ID=".$_GET['ID'])); 

the line above is in the vieworder.php but it is not displaying any record.

please guide what am doing wrong.

Member Avatar


New window and complete the url:

echo "<td><a href='vieworder.php?ID=" . $row->ID . "' target='_blank'>" . $row->ID . "</a></td>";

thanx diafol but thats not dispaying any record

Member Avatar


You should never, EVER do this:

if ($result = $mysqli->query("SELECT * FROM placeorder WHERE ID=".$_GET['ID'])); 

You will open yourself up to SQL injection. Use a prepared statement (or sanitize the input if you really have to).
Also why is there a ';' as the end of the line?

Show all the relevant code for handling the url querystring. This is like digging for coal in the dark.

thanx i figured what was wrong..its just for learning purpose.