How to query using a variable - Forum

Forum Navigation
You need to log in to create posts and topics.

How to query using a variable

Hi everybody

I need to query my db and I need to filter it (WHERE) by a variable from my application [mytextfield]

As the string below the query is not filtering because of variable (i think is not the right way to write the variable)

$sqlQuerys[15]="SELECT materia_prima FROM materia_prima_fm WHERE id_formula_maestra = [mytextfield]";

Any help on how to right format the query?

 

Thanks

@xojo if the SQL is in the PHP config file then you need to use a ? in place of the variables. Then in the neophpexecutesql you pass the variables as the parameters separated by a :

 

Regards

Andy

 

$sqlQuerys[15]="SELECT materia_prima FROM materia_prima_fm WHERE id_formula_maestra = ?";

@xojo please take a look a the database video tutorials series.

javadrajabihakami has reacted to this post.
javadrajabihakami