user3384194
user3384194

Reputation: 141

PHP MySQL Query insert Function

Is there any possibilty to add a function-call in a SQL-Query?

At the moment i'm doing this:

§sql = "SELECT * FROM TABLE";

But I want, that I'm using a field from my table and call with this a function, which return me true or false.

Maybe a example could explain it better:

"$sql = SELECT * FROM TABLE WHERE functionCall(TABLE.FIELD)=true";

Then I just get all entrys from TABLE, where my function returns true.

Is there any possibility to do that?

Upvotes: 1

Views: 52

Answers (1)

echo_Me
echo_Me

Reputation: 37233

you could use If condition before like that :

 $sql = "SELECT * FROM TABLE";

 fetch your query here 

 If(functionCall($row['FIELD'])==true) {
    your wished code here
    .......
  }

Upvotes: 1

Related Questions