Subgrid – Select with variable – empy results

QuestionsSubgrid – Select with variable – empy results
Mauro asked 7 years ago

Hi,
In my subgrid_detail i fetch the _POST(SN) then i want to use it to make a select…like this:

// you can provide custom SQL query to display data
$serial = mysql_real_escape_string($_POST['SN']);
$g->select_command = "SELECT * FROM thermo WHERE SN = '$serial'";

The issue is that mysql return no results…where is the error?

(if i do echo $serial i see that the SN is correct but it seems that into the query is empty)

Thanks

1 Answers
Abu Ghufran answered 7 years ago

The POST cannot be used in query directly.
You need a session variable persistance.

e.g.
if (!empty($_POST["SN"]))
{
$_SESSION["SN"] = $_POST["SN"];
}
$serial = $_SESSION["SN"];

and use `$serial` in your SQL.

Your Answer

3 + 5 =

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?