Sql query table starting from variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Fabiooo7
Forum Newbie
Posts: 10
Joined: Sun Feb 16, 2014 3:23 pm

Sql query table starting from variables

Post by Fabiooo7 »

Hello Friends
How could perform this query?

Code: Select all

$tipo_festa = $_POST["tipo_festa"];
$sql = "SELECT id_produtos,nome_s,tipo,unid,ref,valor,foto,p150 FROM  $tipo_festa  ";
Queria realizar consultas em uma dela de acordo com o retorno de _post quando eu coloco exe. FROM f_15 a consulta funciona perfeitamente mais quando faço isso FROM $tipo_festa

Thanks to All
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Sql query table starting from variables

Post by social_experiment »

Fabiooo7 wrote:How could perform this query?
what would you like to do? Your question is fairly vague...
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply