-2

I want my input text to go in my where query, I can make it work with numbers, but when i try to search with letters in the input field. It doesn't work. Any suggestion? Do i need to convert something ?

<form name="form" method="get">
  <input type="text" name="test">
  <input type="submit" name="button1"  value="Search">
</form>

$nickval = $_GET["test"];

This one is working.

//Establish connection to database
$host = "****";
$conn = ******
$query = " Select * 
from p900
where p900key = $nickval
ORDER BY P900KEY";

This one doesnt work, In input i write AB which is signature.

//Establish connection to database
$host = "****";
$conn = ******
$query = " Select * 
from p900
where p900SIG= $nickval
ORDER BY P900key";

Sorry if im unclear, i tried my best

Rahul Patel
  • 5,248
  • 2
  • 14
  • 26
Mato
  • 5
  • 1
  • 4

1 Answers1

2

For letters in where condition you have to wrapped textbox value in quotes like below.

//Establish connection to database
$host = "****";
$conn = ******
$query = " Select * 
from p900
where p900SIG= '$nickval'
ORDER BY P900key";
Rahul Patel
  • 5,248
  • 2
  • 14
  • 26