1

I'm attempting to make a column be included only if the ID of the column is in the web address. But it's not returning the data. Any suggestions?

This is what my code looks like

$sql="SELECT * FROM orders WHERE `orders`.`id`= '$form_id'";
$order_data=mysql_query($sql);
$form_id=$_GET['id'];

If anyone has any suggestions, please let me know.

Samuel S.
  • 19
  • 1
  • 2
    You're trying to use the `$form_id` value before it even exists. Things have to exist *first* before you can use them. Also, side note, this is wide open to SQL injection. – David Jul 01 '16 at 21:02

1 Answers1

0

You may use this

$form_id=$_GET['id'];
$sql="SELECT * FROM orders WHERE `orders`.`id`= '$form_id'";
$order_data=mysql_query($sql);

Hopefully this will solve your problem

Jahid Mahmud
  • 1,136
  • 1
  • 12
  • 32