0

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

2
Contributors
4
Replies
15
Views
1 Year
Discussion Span
Last Post by nitos
0

New window and complete the url:

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

thanx diafol but thats not dispaying any record

1

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.

0

thanx i figured what was wrong..its just for learning purpose.
SELECT * FROM placeorder WHERE ID=$ID

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.