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.
Thanx

Member Avatar for diafol

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 for diafol

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.
SELECT * FROM placeorder WHERE ID=$ID

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.