Click here to Skip to main content
15,860,859 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to select rows depending on value form one column but value can be two different ones, how do i make it work ?

What I have tried:

$car='Volvo';
$car1='BMW';

select * from cars where n_car='".$car."' and n_car='".$car1."' order by ch_id desc
Posted
Updated 30-Jan-21 23:55pm
Comments
Richard Deeming 1-Feb-21 9:33am    
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.

PHP: SQL Injection - Manual[^]

1 solution

Got the answer

select * from cars where n_car='".$car."' OR n_car='".$car1."' order by ch_id desc
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900