0

I wrote the following code. It works when the primary key is integer. However when the primary key is String (which is what I need) it does not display the selected data in those fields. this is the code:

include("connection.php");
$equipId=$_GET["equipment_id"];
$conn = oci_connect($dbuname, $dbpwd,$db) or die("DB connection unsuccessful!");
$query= "SELECT * FROM EQUIPMENT WHERE EQUIPMENT_ID =".$_GET["equipment_id"];**

Can you please help me with this?

2 Answers2

0

When writing a query all strings must be encased in quotes, you may use single or double quotes.

$query= "SELECT * FROM EQUIPMENT WHERE EQUIPMENT_ID ='".$_GET["equipment_id"]."'";

0

Short answer:

$query= "SELECT * FROM EQUIPMENT WHERE EQUIPMENT_ID ='".$_GET["equipment_id"] . "'";

Proper answer: please escape your inputs. I don't know that particular library you are using but I would advice using PDO or MySQLi

Here is s link that should be helpful: http://php.net/manual/en/function.oci-bind-by-name.php

Alexandre
  • 306
  • 1
  • 7