Tags
MySQL
Asked 3 years ago
17 Jun 2021
Views 253
Osvaldo

Osvaldo posted

Using a variable in the WHERE Clause

I am using PHP with MySQL database. i need to how to pass the value from PHP to Where Clause.

How to use a variable in the WHERE Clause with PHP ?
joomler

joomler
answered Aug 25 '21 00:00


select statement with where clause which getting value from PHP
treat SQL statement as string and append the value from PHP as needed for example :

$student_fname='Mike';
$select="select * from student where `first_name`='".$student_fname."'";
mysqli_query($select); 

above query will find the student who have name is "Mike"
Post Answer