Jump to content

Variable Where Cluase


amg182

Recommended Posts

Hi guys,

 

I have a variable assigned for car model type and would like it to be part of my query WHERE clause.

 

So I figured it should look like this, but doesnt seem to work...

 

 $Model='lexus';  ......      
$sql = "SELECT COUNT(*) FROM (Select * FROM cars WHERE Make='$Model') subq";

 

Am i missing something here? It works fine if I manually type in "lexus" but doesnt like the variable?

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/240958-variable-where-cluase/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.