SQL function CONSTRUCT in MySQL

A

Anonymous

Guest
Hi,

You can construct queries dynamically:

Code:
<?php

$sql = "SELECT '$var1', '$var2' FROM '$table' WHERE '$var3' = '$value3' AND '$var4' = '$value4'";

?>

Where all the variables $var1... $var4 and the others are values defined by the user. All you have to do is to put an '$var' anywhere in your sql that will satisfy your needs.

Regards.
 
you'll need to use a LOT of if statements to do it - e.g.

"select * from table " then if ($_POST["where"] <> '')... and so on for the entire statement.

Andrew
 
Back
Top