custum sql query with where clause for int value

Questionscustum sql query with where clause for int value
Chakkara asked 9 years ago

how to use a php varibale (say $age) in WHERE clause in the custom sql query

myquery is $g->select_command = "SELECT name,age,sex FROM children WHERE age=$age";

this causes error

pls help me

1 Answers
Abu Ghufran answered 9 years ago

Pasting from FAQ: Q) How to load grid based on $_POST data from other page.

Solution is to put the POST variable in session and use it from session for WHERE clause..

e.g.

if (!empty($_POST["personid"]))
{
$_SESSION["personid"] = $_POST["personid"];
}
$pid = $_SESSION["personid"];

and use `$pid` in your SQL.

Your Answer

1 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?